robmarkcole / Hue-remotes-HASS

PLEASE READ THE README
Apache License 2.0
31 stars 9 forks source link

Last button event does not refresh if same button is pressed again #12

Open mikesalz opened 4 years ago

mikesalz commented 4 years ago

On the Philips Hue Dimmer Switch, the last button event seems to "stick" until a different button is pressed. This prevents the user from pressing the button a second time, even if hours later. Can we add an option clear the last event immediately after (or shortly after) a button press?

Example: I use the 3_click_up event (fan off button) to turn off a fan. Let's say I used the button to turn off the fan three hours ago. Then I later turn the fan back on by some means other than the remote. I now cannot use the 3_click_up event to turn off the fan because the last registered button event is still the 3_click_up from three hours ago. If I press the button, no new "to" 3_click_up event is registered now.

This is demonstrated in the screenshot below. The 3_click_up event triggered 3 hours ago, so I cannot trigger it again unless I click another button first.

image

iamcagn commented 4 years ago

Hey @mikesalz,

To work around this, set the trigger as state without any to/from. Then, set a condition for the button, e.g.

condition: state entity_id: remote.bedroom_switch state: 1_click_up

While the button doesn't update, the time pressed does. This means the trigger will always fire, and if the correct condition is met (e.g. button = 1_click_up) then it will run the actions. Pressing the button multiple times will work now.

Additional conditions/checks may need to be made, see: https://github.com/robmarkcole/Hue-remotes-HASS/issues/14

mikesalz commented 4 years ago

Hi @iamcagn - Thanks for responding! I tested that change this morning and it does seem to work.

iamcagn commented 4 years ago

@mikesalz I was having the same issue when I started using the original custom component, and found that tip on the HA community forums. I saw your ticket when I went to create mine, and thought I should pass the knowledge on. I'm glad it worked for you.

robmarkcole commented 4 years ago

The official integration fires events on each button press, which is the correct way to implement a remote in HA.

mikesalz commented 4 years ago

@robmarkcole While I agree that is what SHOULD happen, it does not appear to be working correctly as per my description above.

robmarkcole commented 4 years ago

This is basically the same issue as https://github.com/robmarkcole/Hue-remotes-HASS/issues/14