Skip to content

Commit

Permalink
made changes to setting limitsd using const data and api
Browse files Browse the repository at this point in the history
  • Loading branch information
KirilKurkianec committed Jan 29, 2024
1 parent cdd8bd7 commit 3383a4a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/econet300/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ def _sync_state(self, value):
"""Sync state."""
_LOGGER.debug("EconetNumber _sync_state: %s", value)
self._attr_native_value = value
self.async_set_limits_values()
map_key = NUMBER_MAP.get(self.entity_description.key)
self._attr_native_min_value = ENTITY_MIN_VALUE.get(map_key)
self._attr_native_max_value = ENTITY_MAX_VALUE.get(map_key)
self.async_write_ha_state()
self.async_set_limits_values()

async def async_set_limits_values(self):
"""async Sync number limits."""
Expand All @@ -74,6 +77,7 @@ async def async_set_limits_values(self):
self._attr_native_min_value = limits.min
self._attr_native_max_value = limits.max
_LOGGER.debug("Apply number limits: %s", self)
self.async_write_ha_state()

async def async_set_native_value(self, value: float) -> None:
"""Update the current value."""
Expand Down

0 comments on commit 3383a4a

Please sign in to comment.