Skip to content

Commit

Permalink
debug last message received
Browse files Browse the repository at this point in the history
  • Loading branch information
grimmpp committed Feb 14, 2024
1 parent 33f8bcf commit 3b09afd
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions custom_components/eltako/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@ def __init__(self, platform:str, gateway: EnOceanGateway, dev_id: AddressExpress
super().__init__(platform, gateway, dev_id, dev_name, dev_eep)
self._sender_id = sender_id
self._sender_eep = sender_eep
self._on_state = False

@property
def is_on(self):
"""Return whether the switch is on or off."""
return self._on_state

def turn_on(self, **kwargs: Any) -> None:
"""Turn on the switch."""
Expand All @@ -91,7 +86,7 @@ def turn_on(self, **kwargs: Any) -> None:
self.send_message(msg)

if self.general_settings[CONF_FAST_STATUS_CHANGE]:
self._on_state = True
self._attr_is_on = True
self.schedule_update_ha_state()


Expand Down Expand Up @@ -119,7 +114,7 @@ def turn_off(self, **kwargs: Any) -> None:
self.send_message(msg)

if self.general_settings[CONF_FAST_STATUS_CHANGE]:
self._on_state = False
self._attr_is_on = False
self.schedule_update_ha_state()


Expand All @@ -132,7 +127,7 @@ def value_changed(self, msg: ESP2Message):
return

if self.dev_eep in [M5_38_08]:
self._on_state = decoded.state
self._attr_is_on = decoded.state
self.schedule_update_ha_state()

elif self.dev_eep in [F6_02_01, F6_02_02]:
Expand All @@ -143,5 +138,5 @@ def value_changed(self, msg: ESP2Message):
button_filter |= self.dev_id[1] is not None and self.dev_id[1] == 'right' and decoded.rocker_first_action == 3

if button_filter and decoded.energy_bow:
self._on_state = not self._on_state
self._attr_is_on = not self._attr_is_on
self.schedule_update_ha_state()

0 comments on commit 3b09afd

Please sign in to comment.