I’m currently testing the double click action so i can’t add the delay. Strang thing is I can’t double click to fast or it will show only one zha_event. What is the current firmware of your shortcut? You can find it in integrations>zha>devices>shortcut>manage cluster>cluster: basic>attribute: sw_build_id>press: get zigbee attribute, then press the button a few times.
Just pulled the attributes:
sw_build_id: 2.3.015
hw_version: 1
date_code: 20190715
FWIW, the usual way is to add a condition
that checks the elapsed time between updates (last_updated). For example, this confirms at least 1 second has elapsed:
{{ now(). timestamp () -
states.binary_sensor.whatever.last_updated.timestamp() > 1 }}
However, that works with a State Trigger but this is an Event Trigger; there’s no direct access to the time of the previous event.
Although I think the multiple zha_events shouldn’t happen in the first place, i’ll add a debounce in the blueprint and combine it with the double click. For now.
I want to mention again that i don’t have this problem, in fact it looks like I have a sort of debounce in my setup. A second click won’t register within like 300ms after the first click, which just feels slow for a double click. Any way I have no idea where this is coming from.
So can you guys press the shortcut a couple of times and tell me the maximum time between first and last event of 1 press. I’ll then add this time plus a small margin to the blueprint.
Also, wich coördinator hardware are you guys using? I use a conbee II USB.
Oke jeremydk`s log shows 550ms between the first and last event, this is way to much to combine with the double press action. therefore i’ll create a different blueprint without the double press and with the debounce. I’ll put the link here when it’s uploaded.
Awesome, thanks. I’m also using a conbeeII, and the button is only about 8ft away with open line of sight. If it was solely interference, I’d expect to not always have 6 events fired, but it’s repeatable.
I’m using a Nortek HUSBZB-1 and I’m getting multiple events as well. Could it be a button firmware thing? I just bought my button yesterday.
After a few mornings of no devices responding i decided to give zigbee2mqtt a try. It works really good and is easy to setup, no troubles so far. Maybe you guys should give this a try as i see a lot of complaints about zha recently. For further help on the multiple events i advise you to post an isue in zha or zigpy on github.
I now tried the debounced version… and things are REALLY weird and I can’t figure out what is causing all this.
I have used the new blueprint to setup my Trådfri Shortcut button short press to toggle two devices, my IKEA Trådfri smartplug and one outlet in my Lidl (Tuya) extension lead.
I also setup long press to turn off both these devices.
Both have lamps connected.
When testing multiple button presses (with 1 second delay) suddenly one of the devices stops reacting on the button press and the two lamps now differ. One is still turned on while the other one is turned off.
Next button press toggles and the one that was turned on is now turned off vice versa.
While there are multiple events sent by the shortcut button it feels like it’s more like the Lidl (Tuya) smart extension lead is more sensitive than the Ikea Trådfri smart plug.
This would only be possible if HA sends out one instruction per event to the smart plugs and that the IKEA one has a built in filter.
It’s an annoying little thing but I guess it is something I have to live with.
Anyone experience the same thing? Is it connected to other smart plugs than the ones from IKEA or does it happen to those too?
Hi, I’m a new user and this is my first post. This is the first blueprint i decided to download and test, and it worked perfectly fine. Until this morning. For some reason i can no longer even make it execute manually in HA. I’ve tried to erase both the button and the automation, and re-added the button i n ZHA and used the blueprint and everything over, but it’s not working. I tried several different actions, and none of them executes. If I check devices in ZHA, the button has no automation added to it, but I guess that’s why we need the blueprint, and it was probably not present before either. Even if I enter the automations and manually execute it, nothing happens. All my other automations work fine. What can have I have done wrong?
Edit: Sorry but when I for the third time reconfigured it it suddenly works. Thanks for a great blueprint!
Edit 2: See the other thread about the button in particular. Seems like the fault in my case was that the battery is drained dead after a few hours only. After changing to a new one it works again, but probably it’s draining this one as well. I thought the problem was with the automation since the execute button didn’t work either but now when I got it working again, it’s just working when physically using the button and not via execute. Nothing is touching the button so I just can’t figure out what’s going on.
I tried but since i moved from Conbee2 to sonoff zbbrige (also tried the sonoff pen), none zha_event shows for ikea button presses like befor
Are you using ZHA? There is an issue at the moment with ZHA and IKEA remotes where a poll is draining the battery very quickly. Try pairing the remote thru another router to see if it avoid this problem for the moment and check the opened issue on ZHA GitHub.
Hi everyone
I just saw this blueprint and this may be exactly what I need. However: it doesn’t seem to work with a Tradfri gateway using the ZHA integration.
Is there a way to integrate a Tradfri gateway using a 3rd party integration? The goal for me is to use the button to control a Tuya light.
Thanks in advance
No, you’ll need an universal zigbee coördinator like conbee or cc2531 usb stick. See https://www.home-assistant.io/integrations/zha/. I would personally use zigbee2mqtt instead of zha. In combination with the cheap cc2531 stick. https://www.zigbee2mqtt.io/
Attempted to use this blueprint but inside it says “no devices found” even though I’m using them for other automations with no problem.
Struggling with this one.
My button is paired in ZHA OK, it appears in the dropbox when I setup the automation but doesn’t seem to do anything - The automation never seems to run. I have tried to use the ZHA_EVENTS listener but that doesn’t seem to return anything from any of my zigbee devices.
Not sure where to look next - any advice from anyone?
And it randomly started working about 3 hours later…
Hi,
Ikea e1812 and latest firmware 2.3.080 support double click natively (with a proper zha_event for double click). I have modified the blueprint according to the newest firmware release. I tested and it’s ok. I’m not a developer so everybody feel free to debug/optimize
blueprint:
name: ZHA - IKEA Tradfri Shortcut button
description: Control anything with the ikea shortcut button
domain: automation
input:
shortcut_button:
name: Device
description: Select an IKEA shortcut button
selector:
device:
integration: zha
manufacturer: IKEA of Sweden
model: TRADFRI SHORTCUT Button
button_short:
name: Single click
description: "Choose action(s) when short pressed:"
default: []
selector:
action: {}
button_double:
name: Double click
description: "Choose action(s) when double pressed:"
default: []
selector:
action: {}
button_long:
name: Long click
description: "Choose action(s) when long pressed:"
default: []
selector:
action: {}
source_url: https://community.home-assistant.io/t/zha-ikea-tradfri-shortcut-button/261936
mode: single
max_exceeded: silent
trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "shortcut_button"
action:
- variables:
command: "{{ trigger.event.data.command }}"
cluster_id: "{{ trigger.event.data.cluster_id }}"
endpoint_id: "{{ trigger.event.data.endpoint_id }}"
args: "{{ trigger.event.data.args }}"
- choose:
# short click
- conditions:
- "{{ endpoint_id == 1 }}"
- "{{ cluster_id == 6 }}"
- "{{ command == 'on' }}"
sequence:
- choose:
default: !input "button_short"
- wait_for_trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "shortcut_button"
endpoint_id: 1
cluster_id: 6
command: on
timeout:
seconds: 1
# double click
- conditions:
- "{{ endpoint_id == 1 }}"
- "{{ cluster_id == 6 }}"
- "{{ command == 'off' }}"
sequence:
- choose:
default: !input "button_double"
- wait_for_trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "shortcut_button"
endpoint_id: 1
cluster_id: 6
command: off
timeout:
seconds: 1
# long click
- conditions:
- "{{ endpoint_id == 1 }}"
- "{{ cluster_id == 8 }}"
- "{{ command == 'move_with_on_off' }}"
sequence:
- choose:
default: !input "button_long"
- wait_for_trigger:
- platform: event
event_type: zha_event
event_data:
device_id: !input "shortcut_button"
endpoint_id: 1
cluster_id: 8
command: stop
timeout:
seconds: 1
Every time I use this blueprint I get different results. I have the feeling that here reacts to very many events and it is always a coincidence which wins.
Here is an example where I pressed the button once (!):
- Triggered by the event ‘zha_event’ at 29. November 2021, 09:11:48: Finished at 29. November 2021, 09:11:48 (runtime: 0.10 seconds)
- Triggered by the event ‘zha_event’ at 29. November 2021, 09:11:48: Stopped because only a single execution is allowed at 29. November 2021, 09:11:48 (runtime: 0.00 seconds)
- Triggered by the event ‘zha_event’ at 29. November 2021, 09:11:48: Stopped because only a single execution is allowed at 29. November 2021, 09:11:48 (runtime: 0.00 seconds)
I also captured a click in the events display, there also 3 ones. I attached it as a PNG