Integrate double click and hold into Home assistant?
Opened this issue ยท 10 comments
Is there a way to integrate double click and hold into Home assistant?
You get the click type as an attribute on the button sensor. It should say either, single, double or hold.
I'm not sure if that is the best approach, or do you have any other suggestion?
Shoot, I'm sorry I meant to say that could you have it reset the click type in home assistant. When I am creating automations based on the click type field change it won't capture a double click changing to a double click or hold changing to a hold. Does that make sense or should I be using automations with double click and hold differently?
You should probably make an automation based on when the button is clicked and add condition based on click type instead.
Like this?
alias: CouchFlic Single click
description: Play/Pause GoogleTV
trigger:
- type: turned_on
platform: device
device_id: 3ad28e017398cf95109896b8de6a8deb
entity_id: b16677ec366c8b04ffd795a45dc07397
domain: binary_sensor
for:
hours: 0
minutes: 0
seconds: 1
condition: - condition: and
conditions:- condition: state
entity_id: binary_sensor.flichub_kid_flic
attribute: click_type
state: single
action:
- condition: state
- service: media_player.media_play_pause
data: {}
target:
entity_id: media_player.google_tv
mode: single
The issue when i do this when i double click or hold the single click automation action will still happen
I will look further into this next. thank you for reporting.
I can confirm I'm having the same issue. The status of the last action persists. So if you last did a single click and you do so again, it doesn't register as the status hasn't changed, and the automation subsequently fails unless you use one of the other click types first.
Using a condition doesn't quite cut it for me, as I'm using the button as part of a larger automation and I can't have this button's status blocking it for WAF reasons.
I note from the events that the button's press type isn't recorded until it's released, which makes sense as that won't be known when the button is first pressed. So maybe changing the status to "pressed" (or something else) when it's being pressed, that would be a quick fix
Here to add another vote to understand how to get double clicks and hold's working correctly.
I'm actually struggling to do anything other than single clicks, which means I'm losing 2/3's of the function of these brilliant buttons
Thank you for the work, and same issue - looking at how to capture single/double/hold click types for different automations, and I'm coming up blank. Thoughts?
UPDATE: I found this blueprint, and it works PERFECTLY - just add the blueprint, then make an automation for your button based on this and it combines actions for single/double/hold into one automation. BEAUTIFUL!
Thank you @aacentric!
I'm looking into Device Actions to properly handling different click types, but I haven't been able to get the time to implement it yet. Any help is appreciated ๐