mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Address late review for Omnilogic Switch (#50404)
* Address previous PR comments. * Update all instances of async_schedule_update_ha_state to async_write_ha_state.
This commit is contained in:
parent
207ee39d00
commit
7ea23533cf
@ -176,3 +176,5 @@ def check_guard(state_key, item, entity_setting):
|
|||||||
for guard_key, guard_value in guard_condition.items()
|
for guard_key, guard_value in guard_condition.items()
|
||||||
):
|
):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
@ -136,7 +136,7 @@ class OmniLogicPumpSpeedSensor(OmnilogicSensor):
|
|||||||
self._unit = PERCENTAGE
|
self._unit = PERCENTAGE
|
||||||
state = pump_speed
|
state = pump_speed
|
||||||
elif pump_type == "DUAL":
|
elif pump_type == "DUAL":
|
||||||
self._unit = ""
|
self._unit = None
|
||||||
if pump_speed == 0:
|
if pump_speed == 0:
|
||||||
state = "off"
|
state = "off"
|
||||||
elif pump_speed == self.coordinator.data[self._item_id].get(
|
elif pump_speed == self.coordinator.data[self._item_id].get(
|
||||||
|
@ -57,7 +57,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||||||
|
|
||||||
|
|
||||||
class OmniLogicSwitch(OmniLogicEntity, SwitchEntity):
|
class OmniLogicSwitch(OmniLogicEntity, SwitchEntity):
|
||||||
"""Define an Omnilogic Base Switch entity which will be instantiated through specific switch type entities."""
|
"""Define an Omnilogic Base Switch entity to be extended."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -108,7 +108,7 @@ class OmniLogicRelayControl(OmniLogicSwitch):
|
|||||||
"""Turn on the relay."""
|
"""Turn on the relay."""
|
||||||
self._state = True
|
self._state = True
|
||||||
self._last_action = time.time()
|
self._last_action = time.time()
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
await self.coordinator.api.set_relay_valve(
|
await self.coordinator.api.set_relay_valve(
|
||||||
int(self._item_id[1]),
|
int(self._item_id[1]),
|
||||||
@ -121,7 +121,7 @@ class OmniLogicRelayControl(OmniLogicSwitch):
|
|||||||
"""Turn off the relay."""
|
"""Turn off the relay."""
|
||||||
self._state = False
|
self._state = False
|
||||||
self._last_action = time.time()
|
self._last_action = time.time()
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
await self.coordinator.api.set_relay_valve(
|
await self.coordinator.api.set_relay_valve(
|
||||||
int(self._item_id[1]),
|
int(self._item_id[1]),
|
||||||
@ -167,7 +167,7 @@ class OmniLogicPumpControl(OmniLogicSwitch):
|
|||||||
"""Turn on the pump."""
|
"""Turn on the pump."""
|
||||||
self._state = True
|
self._state = True
|
||||||
self._last_action = time.time()
|
self._last_action = time.time()
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
on_value = 100
|
on_value = 100
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ class OmniLogicPumpControl(OmniLogicSwitch):
|
|||||||
"""Turn off the pump."""
|
"""Turn off the pump."""
|
||||||
self._state = False
|
self._state = False
|
||||||
self._last_action = time.time()
|
self._last_action = time.time()
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
if self._pump_type != "SINGLE":
|
if self._pump_type != "SINGLE":
|
||||||
if "filterSpeed" in self.coordinator.data[self._item_id]:
|
if "filterSpeed" in self.coordinator.data[self._item_id]:
|
||||||
@ -213,7 +213,7 @@ class OmniLogicPumpControl(OmniLogicSwitch):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if success:
|
if success:
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise OmniLogicException(
|
raise OmniLogicException(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user