Skip to content

Commit

Permalink
standardize state value with firmware state reply
Browse files Browse the repository at this point in the history
  • Loading branch information
dgomes committed Feb 27, 2024
1 parent fea4ebf commit d257639
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions custom_components/openhasp/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ async def idle_message_received(msg):

if message == HASP_IDLE_OFF:
brightness = self._awake_brightness
backlight = 1
backlight = "on"
elif message == HASP_IDLE_SHORT:
brightness = self._idle_brightness
backlight = 1
backlight = "on"
elif message == HASP_IDLE_LONG:
brightness = self._awake_brightness
backlight = 0
backlight = "off"
else:
return

Expand Down Expand Up @@ -374,7 +374,7 @@ async def refresh(self):
"""Sync local state back to plate."""
cmd_topic = f"{self._topic}/command"

new_state = {"state": self._state, "brightness": self._brightness}
new_state = {"state": "on" if self._state else "off", "brightness": self._brightness}

_LOGGER.debug("refresh(%s) backlight - %s", self.name, new_state)

Expand Down

0 comments on commit d257639

Please sign in to comment.