mirror of
https://github.com/Andre0512/hon.git
synced 2025-05-14 23:24:24 -04:00
Fix some small bugs
This commit is contained in:
parent
bb700dd2f7
commit
c0d25a4efe
4 changed files with 11 additions and 17 deletions
|
@ -388,7 +388,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
|
|||
setting = self._device.settings[f"settings.{self.entity_description.key}"]
|
||||
if type(setting) == HonParameter:
|
||||
return
|
||||
setting.value = setting.max if isinstance(setting, HonParameterRange) else "1"
|
||||
setting.value = setting.max if isinstance(setting, HonParameterRange) else 1
|
||||
self.async_write_ha_state()
|
||||
await self._device.commands["settings"].send()
|
||||
await self.coordinator.async_refresh()
|
||||
|
@ -397,7 +397,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
|
|||
setting = self._device.settings[f"settings.{self.entity_description.key}"]
|
||||
if type(setting) == HonParameter:
|
||||
return
|
||||
setting.value = setting.min if isinstance(setting, HonParameterRange) else "0"
|
||||
setting.value = setting.min if isinstance(setting, HonParameterRange) else 0
|
||||
self.async_write_ha_state()
|
||||
await self._device.commands["settings"].send()
|
||||
await self.coordinator.async_refresh()
|
||||
|
@ -413,8 +413,7 @@ class HonSwitchEntity(HonEntity, SwitchEntity):
|
|||
|
||||
@callback
|
||||
def _handle_coordinator_update(self, update=True) -> None:
|
||||
value = self._device.get(self.entity_description.key, 0)
|
||||
self._attr_state = value == 1
|
||||
self._attr_is_on = self.is_on
|
||||
if update:
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
@ -490,7 +489,6 @@ class HonConfigSwitchEntity(HonEntity, SwitchEntity):
|
|||
|
||||
@callback
|
||||
def _handle_coordinator_update(self, update=True) -> None:
|
||||
value = self._device.settings.get(self.entity_description.key, "0")
|
||||
self._attr_state = value == "1"
|
||||
self._attr_is_on = self.is_on
|
||||
if update:
|
||||
self.async_write_ha_state()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue