klali / ha-plejd

Plejd component for Home Assistant
Apache License 2.0
69 stars 15 forks source link

Detection of "double tap" #37

Closed mist0706 closed 3 years ago

mist0706 commented 3 years ago

It is possible using the plejd app to configure scenes to be triggered by doubletapping the plejd connected buttons. Is it possible to capture these events to trigger automations in homeassistant?

klali commented 3 years ago

It should be, I haven't been interested in those kind of features so I haven't looked. If you enable debug and look at the messages that fall out from a double tap I can try to help you decode them.

mist0706 commented 3 years ago

I turned on debug and tested this out, there are no noticeable events in the log, nothing about a double tap being detected

2021-01-09 22:33:24 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned True 2021-01-09 22:33:25 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned True with brightness 3b3b 2021-01-09 22:33:40 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned False 2021-01-09 22:33:41 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned False with brightness 3b3b 2021-01-09 22:33:42 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned True 2021-01-09 22:33:42 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned False 2021-01-09 22:33:44 DEBUG (MainThread) [custom_components.plejd.light] Cinema(0b) turned False with brightness 3b3b

klali commented 3 years ago

Interesting. If something happens on the network that the platform doesn't recognize it should either log "No match for device..." or "No match for command..."

I'm not using the plejd scenes or double taps, so I haven't looked into this.

mist0706 commented 3 years ago

Could it be that the command is stored locally on the button? It seems unlikely that no message would be sent through the mesh upon activation.

klali commented 3 years ago

So I just tried this.

The relevant log when triggering a scenario is "No match for device '02' (b'02011000210200000080')" which we can then disect:

02 = ? some sort of broadcast 0110 = command 0021 = the command identifier 02 = scene identifier 00000080 = ?

I'm not sure how this would be useful to represent in homeassistant.

mist0706 commented 3 years ago

To generate this output, did you assign a scene to the button first? I tested on a button with no assigned scene.

klali commented 3 years ago

Yes. Given how plejd seems to work I think it's unlikely we can get anything from an "unassigned" double click.

mist0706 commented 3 years ago

Ah. Then i think the usecase is very limited. Perhaps to notify homeassistant that a scene was triggered however every plejd scene needs an assignment which means if you want homeasssitant to also do an action the button would always do at least 2 things. the one defined by plejd scene and the one defined in hass

mist0706 commented 3 years ago

Closing due to limited usecase.