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

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.

near as i can tell it’s gotta be something else - the traces on the automation seem to be fine, the controller is firing 5002 and 4002 events on the right and left buttons, and the time looks to be correct as well - the automation just isn’t picking up the double presses, and i’m legitimately bamboozled as to why

i got it working!
the deconz regex above isn’t quite right, or at least it wasn’t for me. this is what got me up and running in the end:

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

the regex for deconz above in the thread wasn’t parsing the quotes around the “a” properly, and needed to be escaped for a literal match, as with the “t”

I learnt quite a bit about regex tonight! thanks for the help @Nick4
it was absolutely something else, and i’m glad i wasn’t going nuts

1 Like

I’ve installed this and added the latest regex mod… but I can’t seem to get the up, left, right, or down buttons to work. Only the center button (but both for click and double click.)

Trace shows:

Triggered by the event 'zha_event' at September 21, 2023 at 9:29:36 PM
Test Test if 2 conditions matches
Delay for 50 milliseconds
Define variables trigger_action, trigger_delta, and last_controller_event
Call a service 'Input text: Set' on
(input_text.julieremotelastcontrolledevent) turned {"a":"step_with_on_off_StepMode.Up_43_5","t":1695346176.657274}
Choose: No action taken
Finished at September 21, 2023 at 9:29:36 PM (runtime: 0.06 seconds)

Any suggestions?