This automation might be quite useful for me. I have attached Shelly 2.5 to my roller shutters. They are controlled by the Shelly via Home Assistant, or old school via two buttons (Up, Down).
The buttons return to their original possition, when released (off). Currently the buttons are connected to the relais of the Shelly, but they can be configured as detached buttons. Then they would not trigger anyhting in the Shelly directly, but the state of the button can be read by home assistant and home assistant can trigger actions.
I would like to use this to for example control the roller shutter (cover) in a normal manner on a single click (e.g. call close cover when down is pressed once, call stop cover, when pressed again). But if a double click is detected, close cover for all covers in the room could be triggered. I think this blueprint will help me to get there.
I tried to import the blueprint into my configuration, but received an error.
Is there a way to manually copy the automation? If not using the blueprint itself, where would the input definitions be defined?
I have now tried the following:
I also noticed that the blueprint defines a delay, which is defined to be a decimal number (the mask only accepts integers (i.e. full numbers). However the delay is not used by the automation. Here the timeout is hardcoded to 0.3 seconds not using the delay defined above.
Thanks. I managed to import the blueprint correctly and setup an automation to use it. I had to tweak the delay a little bit as initially mostly a longpress was detected, no matter what how long/often I pressed. I have increased the value from 0.3 to 0.5 and am now receiving the correct notifications for each button press. Thanks for the blueprint.
I will now need to find out how to action the cover correctly according to its current state and see if that introduced delay is recognizable in the short click scenario as it is expected to open/close/stop the cover immediately.
I made a little improvement.
If no double click action is defined, do not wait for the timeout of the delay after the first click -> it makes the automation more reactive in the scenario where no double click is configured.
Thanks for the blueprint!
That is exactly what I was searching for.
I only have the problem that a single press is not reliably detected by the blueprint. I have a button connected to a Shelly 1. The Single press is not detected when I press it really short. (Like when you go in a room and you quickly want to switch on the light)
However it is possible to trigger a single press by pressing slightly longer.
I have tried to play around with the timeout but this only effects the Long press.
When I listen to event shellyforhass.click in the Developer Tools in Home Assistant however it will be displayed as following:
Hello,
I use the same delay to detect a short vs. long click as for the pause between 2 clicks to consider it as a double click.
So basically, if the time between the binary_sensor being on and off again is < the delay (0,3 s by default), it will be considered as a single click (if the binary sensor doesn’t change to on again before the delay (0,3 s by default)). Otherwise, it is consider as a long click.
So what I’m saying is that, in theory, if a on/off event occurs on the binary sensor, the automation will trigger a single or a long click action, but it will trigger an action.
I suggest you verify that, when you do you ‘quick single click’, the binary sensor really goes from off to on. Maybe it is you shelly that doesn’t trigger an event if it is two quick/or trigger a wrong event??
Okay, thanks.
A stupid question: (sorry I just started with home assistant. )
How can I do this verification of the binary_sensor?
I tried already with Developer Tools > EVENTS > Listen to events
and entered binary_sensor.* but I can’t see any event when I press the button.
When I enter shellyforhass.click there I will get the following for a single (quick single click) and long press:
I can’t see any entry from this particular shelly. But I can see the binary sensor value changing when I go to Configuration > Device > [the shelly I want to use] > [select the binary sensor I want].
See the screenshot below.
This is exactly what I was after thanks slashback.
Question though is it easy enough to add in the option of multiple binary inputs.
for example I have a set of lights that can be controlled from 4 locations, atm I have just duplicated this 4 times but would be great if it could all be done in.
Thanks, slashback!
Although I’m rather new to Home Assistant, I was looking for that to implement in my ESP32. I’m planning to use 3 touchpads and one push-button to start 12 different automations and your blueprint seems to enable that (I still have to learn how to quadruplicate that…) . Anyway, I’ll study that and post here either questions or ideas.
Amazing! This is exactly what I was looking for. Thanks so much, slashback. I’m using it with an ESPhome binary sensor connected to a push-button.
For me, the short click does not work. Double click works fine. But any click, no longer how long I hold it down for registers as a long click. I have tried to change the time interval, but this doesn’t help.
EDIT: so it turn out the button on ESP home that I was using defaults to an ‘on’ state when not pressed and ‘off’ when pressed. And that’s why the short press was not working. I inverted the state value and now it works great. Thanks again.
Hi! Thanks for your blueprint!
I use blitzwolf switch module with analog switches, and create template binary sensor, that listen status of switch. And by this blueprint, i can use double click actions for my home)
Thanks a lot!
Thank you very much. Pretty close to what I was looking for.
Just one question - being very new to this whole automation topic.
For click, dbl click and long click I can add actions - one for each light.
How would I change this to be able to toggle groups of lights?