diff --git a/custom_components/solis_modbus/const.py b/custom_components/solis_modbus/const.py index 4b04547..babcfcb 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.3.1" -POLL_INTERVAL_SECONDS = 5 +VERSION = "1.3.2" +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 f2a4e3c..9efec81 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.5.4"], - "version": "1.3.1" + "version": "1.3.2" } diff --git a/custom_components/solis_modbus/sensor.py b/custom_components/solis_modbus/sensor.py index 22e4552..cd02dcd 100644 --- a/custom_components/solis_modbus/sensor.py +++ b/custom_components/solis_modbus/sensor.py @@ -25,7 +25,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn sensor_entities: List[SensorEntity] = [] sensor_derived_entities: List[SensorEntity] = [] hass.data[DOMAIN]['values'] = {} - hass.data[DOMAIN]['POLL_COUNTER'] = 0 sensors = [ { @@ -579,7 +578,6 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn }, ] - sensors_derived = [ {"type": "SDS", "name": "Solis Status String", "unique": "solis_modbus_inverter_current_status_string", "multiplier": 0, @@ -635,7 +633,6 @@ def async_update(now): for sensor_group in sensors: start_register = sensor_group['register_start'] - scan_interval = sensor_group['scan_interval'] count = sum(len(entity.get('register', [])) for entity in sensor_group.get('entities', [])) @@ -655,11 +652,7 @@ def async_update(now): for entity in hass.data[DOMAIN]["sensor_derived_entities"]: entity.update() - hass.data[DOMAIN]['POLL_COUNTER'] += 1 - - # Schedule the update function to run every X seconds async_track_time_interval(hass, async_update, timedelta(seconds=POLL_INTERVAL_SECONDS)) - return True diff --git a/custom_components/solis_modbus/time.py b/custom_components/solis_modbus/time.py index 3914932..3192333 100644 --- a/custom_components/solis_modbus/time.py +++ b/custom_components/solis_modbus/time.py @@ -119,6 +119,7 @@ def update(self): _LOGGER.debug(f'Update time entity with hour = {hour}, minute = {minute}') self._attr_native_value = time(hour=hour, minute=minute) + # self.async_write_ha_state() @property def device_info(self): @@ -136,10 +137,10 @@ def set_native_value(self, value): if self._attr_native_value == value: return _LOGGER.debug(f'set_native_value : register = {self._register}, value = {value}') - self._attr_native_value = value - self.schedule_update_ha_state() async def async_set_value(self, value: time) -> None: """Set the time.""" _LOGGER.debug(f'async_set_value : register = {self._register}, value = {value}') self._modbus_controller.write_holding_registers(self._register, [value.hour, value.minute]) + self._attr_native_value = value + self.async_write_ha_state()