HASwitchPlate / HASPone

DIY LCD touchscreen for Home Automation
MIT License
426 stars 48 forks source link

Add option to drop touch events when backlight is off #112

Closed jjfalling closed 3 years ago

jjfalling commented 3 years ago

This adds functionality to optionally ignore touch events when the screen backlight is off and send an MQTT message to the topic hasp/[node]/eventwhilescreenoff.

This will allow HA to control the backlight on a schedule, and when off, temporarily turn back on when the user touches the screen. This could also be used for a child lock.

aderusha commented 3 years ago

Thanks for the code! I've made some minor changes in how this works, including a change in the MQTT messaging to better align with the existing namespace. If you're planning on developing blueprints around this, take note as I don't want to be screwing this up for you :D

Here's what I've done for the MQTT messages when a button is pressed then released when your option is enabled and backlight is off:

hasp/plate01/state/json {"event_type":"button_press_disabled","event":"p[1].b[1]","value":"ON"}
hasp/plate01/state/json {"event_type":"button_release_disabled","event":"p[1].b[1]","value":"ON"}

So, we continue to report what has happened, but changed the event_type so that existing blueprints won't be triggered. Also, these messages are only sent on the JSON topic so as not to trigger automations that are listening to the non-JSON namespace.

jjfalling commented 3 years ago

Sounds good!