HASwitchPlate / openHASP-custom-component

Home Assistant custom component for openHASP
https://www.openhasp.com
MIT License
51 stars 12 forks source link

Backlight turns back on if turned off manually #62

Closed nagyrobi closed 8 months ago

nagyrobi commented 3 years ago

Version of the custom_component

a7fdd68

Configuration

kép

{"page":0,"id":6,"obj":"obj","swipe":1,"x":0,"y":0,"h":35,"w":240,"opacity":0,"radius":0,"comment":"swipe-area-at-top"}
      - obj: "p0b6"  # backlight turn off long-press
        event:
          "long":
            - service: light.turn_off
              entity_id: "light.plate_4_backlight"

Describe the bug

I manually turn off the backlight of the plate by long-touching an object on the plate mapped to HA's light.plate_4_backlight switch. After the plate changes to short idle, the light turns back on by itself.

If the user manually turns off the backlight at any time, no idle state change should turn it back on.

Debug log

2021-07-07 19:41:18 DEBUG (MainThread) [custom_components.openhasp.light] received backlight plate_4 backlight: {'state': False, 'brightness': 255}
2021-07-07 19:42:19 DEBUG (MainThread) [custom_components.openhasp.light] Idle state for plate_4 backlight is short - Dimming to 125; Backlight to 1
2021-07-07 19:42:20 DEBUG (MainThread) [custom_components.openhasp.light] received backlight plate_4 backlight: {'state': True, 'brightness': 125}
fvanroie commented 2 years ago

In 0.6.3-dev you can now set e.g. idle=long on the plate, which will force the idle timer to that state.

You won't get idle short events until manually interacting with the touchscreen or setting idle to another state with the idle command. Previously you could only use idle=off to wake the plate, now you can also set it to sleep.

fvanroie commented 2 years ago

In 0.6.3-dev you can now set e.g. idle=long on the plate, which will force the idle timer to that state.

Its behavior is different from the old wakeup command. So service openHASP: Wakeup would need an update/rename to maybe openHASP: Idle

fvanroie commented 1 year ago

Instead of only turning off the backlight, you can first force idle long and then turn off the backlight. This way, both states are linked and the backlight will not turn back on since idle won't fire anymore because it is already in the long state.