1010 DOMAIN ,
1111 CONF_DIMMER_DEVICE ,
1212 CONF_P1_TOTAL_ENTITY ,
13- DEFAULT_UPDATE_INTERVAL ,
13+ DEFAULT_MIN_UPDATE_INTERVAL ,
1414)
1515
1616_LOGGER = logging .getLogger (__name__ )
@@ -31,12 +31,11 @@ def __init__(self, hass: HomeAssistant, config_entry):
3131 self .power_sensor_id = config_entry .data [CONF_P1_TOTAL_ENTITY ]
3232
3333 # Options
34- self .update_interval = config_entry .options .get ("update_interval" , DEFAULT_UPDATE_INTERVAL )
3534 self .min_dimmer_value = config_entry .options .get ("min_dimmer_value" , 0 )
3635 self .max_dimmer_value = config_entry .options .get ("max_dimmer_value" , 100 )
3736
3837 # Throttling to prevent too frequent updates (configurable, default 2 seconds)
39- self .min_update_interval = config_entry .options .get ("min_update_interval" , 2 )
38+ self .min_update_interval = config_entry .options .get ("min_update_interval" , DEFAULT_MIN_UPDATE_INTERVAL )
4039
4140 _LOGGER .debug (
4241 "Initialized BoilerController: Power Sensor=%s, Dimmer=%s, min_update_interval=%ds" ,
@@ -93,6 +92,7 @@ async def _async_power_sensor_changed(self, event: Event):
9392 return
9493
9594 # Only update if power value actually changed significantly (more than 1W difference)
95+ # TODO: Consider making this threshold configurable as the controller needs more than 200 watt to perform well
9696 if self ._last_power_value is not None and abs (new_power_value - self ._last_power_value ) < 1 :
9797 _LOGGER .debug ("Skipping update - power change too small: %.1fW" , abs (new_power_value - self ._last_power_value ))
9898 return
0 commit comments