🎮 ZHA, deCONZ, Zigbee2MQTT - Ikea 5-button Remote Universal blueprint - all actions + double click events - control lights, media players and more with Hooks

Guys, just bumped on this while searching for something else: of course it’s possible to mix the use for different purposes.
I do this for lights and mediaplayers.

Hi guys, I’m using this remote to control mainly my mediaplayers but also some lights/helpers.
For some buttons I use the long or double press functionality.

This has worked flawlessly until some time ago and for a reason I cannot find, the double press doesn’t work anymore.
The (Optional) Expose x button double press event is enabled.
I increased Helper - Double Press delay input to 10000 but still a double press is seen as single.
Does anyone have the same problem or an idea what might be wrong?

Yeah I just noticed today my double presses also don’t work like they used too. I haven’t looked into it much but if I do (and get them working) will let you know.

Double clicks have been having issues since HA 2023.5 was released.
See the following issues discussion which contains work-around to get it working:

I applied the fix and its working for me using Zigbee2MQTT:

Search for the regex_match code and replace it with the following (some spaces have been removed):

regex_match("^{((“a”:".*"|“t”:\d+.\d+)(,)?){2}}$"))

1 Like

THANK YOU, you have put me in the right direction! :+1:

At first I didn’t have a clue where to find this and then it didn’t work since the code you gave seems to be for another zigbee integration.

For anyone having this double click issue.

You have to open the blueprint file (so not the blueprint in your HA UI but in your filesystem) for the automation you used for this button. (maybe make a copy)
Find regex_match and replace the string following to it.
This string is different for the type of zigbee integration you use.

For Zigbee2MQTT it’s:

regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$"))

For deCONZ:

regex_match("^{(("a":.*|"t":\d+.\d+)(,)?){2}}$"))

For ZHA: can’t find the code but you have to remove the spaces between the brackets.

Save the file and reload your automations.

5 Likes

I have tried this with no luck - surely the official blueprint can be updated?

Hi Damien, what did you do?
It’s not that hard, for me this was unknown terrain too.

Which integration do you use?

1 Like

Using Zigbee2MQTT.

Just managed to fix it though. I copied the latest blueprint yaml files from the awesome-ha-blueprints repo and removed 6 spaces total, 3 from each of the regex lines.

1 Like

This worked for ZHA. 6 total spaces in 2 different regex lines.

Sorry, but which spaces between which brackets?

 regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
      last_controller_event: '{{ (states(helper_last_controller_event) | from_json).a if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")) else "" }}'

I thought we needed spaces between {{ and the (

Hi, this blueprint looks great but the UP and DN buttons are not working for me.
The UP button sends this: {“a”:“step_with_on_off_StepMode.Up_43_5”,“t”:1691605619.133851}
and DN this: {“a”:“step_StepMode.Down_43_5_0_0”,“t”:1691605611.559078}
Any ideas?
Thank you

Hi Dave, I just did a recap from what I found when I had this issue as well.
I just used the that example for z2m which solved my problem.

As you can see, there are no spaces between the {{ and (

So what is in the Git repo is already correct? What I posted just above is exactly how it currently is in the repo

You need to change it to:

 regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
      last_controller_event: '{{ (states(helper_last_controller_event) | from_json).a if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")) else "" }}'

ie. remove the space between the : and \ and also between the , and )

1 Like

does this fix work in 2023.7?

I’m trying to apply it in mine, and it keeps generating this error each time i chuck the new deconz regex in and reload my automations:

invalid template (TemplateSyntaxError: expected token ',', got 'a') for dictionary value @ data['action'][1]['variables']['last_controller_event']. Got '{{ (states(helper_last_controller_event) | from_json).a if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^{(("a":.*|"t":\\d+.\\d+)(,)?){2}}$")) else "" }}' invalid template (TemplateSyntaxError: expected token ',', got 'a') for dictionary value @ data['action'][1]['variables']['trigger_delta']. Got '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^{(("a":.*|"t":\\d+.\\d+)(,)?){2}}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'

Hi, welcome to the forum!

You seem to have used the wrong string.
Have a look a little higher in this topic for my post with the correct one for deCONZ.

1 Like

i’d have sworn up and down i was using the deconz one

i suppose that’s what happens when you try this stuff before bed haha

for my own sanity, this:

regex_match("^{(("a":.*|"t":\d+.\d+)(,)?){2}}$"))

is the correct string, isn’t it?

I’ve replaced the regex that appears on lines 439 and 440 of the blueprint, but it’s still not working for me - I’ll be honest, I suck at regex, and I’m not even sure where I should start to begin troubleshooting. If someone could point me in the correct direction, I’d be eternally grateful.

i don’t suppose anyone has any ideas as to the above?
i’ve tried mucking round a bit over the last couple weeks, and i just can’t seem to get it working as it should with the double presses

the single press works fine, but no matter what i do, the double press just doesn’t seem to work

If you have solved the issue of the spaces correctly it will be something else.