diff --git a/custom_components/solis_modbus/const.py b/custom_components/solis_modbus/const.py index ccf8ed4..5334c4d 100644 --- a/custom_components/solis_modbus/const.py +++ b/custom_components/solis_modbus/const.py @@ -1,6 +1,6 @@ DOMAIN = "solis_modbus" CONTROLLER = "modbus_controller" -VERSION = "1.4.7" +VERSION = "1.4.8" POLL_INTERVAL_SECONDS = 15 MANUFACTURER = "Solis" MODEL = "S6" diff --git a/custom_components/solis_modbus/manifest.json b/custom_components/solis_modbus/manifest.json index be9f00a..9dd9e0d 100644 --- a/custom_components/solis_modbus/manifest.json +++ b/custom_components/solis_modbus/manifest.json @@ -10,5 +10,5 @@ "issue_tracker": "https://github.com/Pho3niX90/solis_modbus/issues", "quality_scale": "silver", "requirements": ["pymodbus>=3.6.8"], - "version": "1.4.7" + "version": "1.4.8" } diff --git a/custom_components/solis_modbus/number.py b/custom_components/solis_modbus/number.py index a590a72..0305bcd 100644 --- a/custom_components/solis_modbus/number.py +++ b/custom_components/solis_modbus/number.py @@ -82,11 +82,12 @@ async def async_setup_entry(hass, config_entry: ConfigEntry, async_add_devices): @callback def update(now): """Update Modbus data periodically.""" + controller = hass.data[DOMAIN][CONTROLLER] + _LOGGER.info(f"calling number update for {len(hass.data[DOMAIN]['number_entities'])} groups") - hass.create_task(get_modbus_updates(hass)) + hass.create_task(get_modbus_updates(hass, controller)) - async def get_modbus_updates(hass): - controller = hass.data[DOMAIN][CONTROLLER] + async def get_modbus_updates(hass, controller): if not controller.connected(): await controller.connect() await asyncio.gather( @@ -140,6 +141,7 @@ def update(self): value: float = self._hass.data[DOMAIN]['values'][str(self._register)] self._hass.create_task(self.update_values(value)) + self.schedule_update_ha_state() async def update_values(self, value): if value == 0 and self._modbus_controller.connected():