diff --git a/custom_components/aquarea/number.py b/custom_components/aquarea/number.py index ba57014..22d8ca7 100644 --- a/custom_components/aquarea/number.py +++ b/custom_components/aquarea/number.py @@ -58,9 +58,6 @@ def __init__( self._attr_unique_id = ( f"{config_entry.entry_id}-{description.heishamon_topic_id}" ) - if self.entity_description.initial_value is not None: - self._attr_native_value = self.entity_description.initial_value - self.async_write_ha_state() async def async_set_native_value(self, value: float) -> None: _LOGGER.debug( @@ -82,6 +79,10 @@ async def async_set_native_value(self, value: float) -> None: async def async_added_to_hass(self) -> None: """Subscribe to MQTT events.""" + if self.entity_description.initial_value is not None: + self._attr_native_value = self.entity_description.initial_value + self.async_write_ha_state() + @callback def message_received(message): """Handle new MQTT messages."""