Open hackintoshlover opened 10 months ago
same here. Also a note is that the (Optional) Helper - Double Press delay is working-isch, it takes the delay, after that it just fires the single press action
I also have this problem and did a little digging in the traces. It seems like the time since the last command doesn't get set correctly. I'm currently working on finding out where the problem exactly lies and will try to fix it.
I found the problem. It has to do with RegEx.
The problem occurs both when trying to set trigger_delta
and last_controller_event
.
It seems that for some time now the regex to determine if the Helper contains the correct string doesn't match, even though it is correct.
I am in no way a home assistant or scripting expert but to me it seems like some way down the line the way home assistant handles whitespaces in RegEx changed.
This is the current way the automation checks for the correctness:
trigger_delta: >-
{{ (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 }}
If you change this to:
trigger_delta: >-
{{ (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 }}
It gets matched correctly. All I did was remove all whitespaces in the RegEx.
I found the problem. It has to do with RegEx. The problem occurs both when trying to set
trigger_delta
andlast_controller_event
. It seems that for some time now the regex to determine if the Helper contains the correct string doesn't match, even though it is correct.I am in no way a home assistant or scripting expert but to me it seems like some way down the line the way home assistant handles whitespaces in RegEx changed.
This is the current way the automation checks for the correctness:
trigger_delta: >- {{ (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 }}
If you change this to:
trigger_delta: >- {{ (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 }}
It gets matched correctly. All I did was remove all whitespaces in the RegEx.
Hi glad it worked for you. just two quick questions: 1) Where do i make these changes? 2) The only change i see is regex_match changed to a new line. That fixes it?
I will try to create a Pull request today so you can just import the blueprint again. But I'll also look into how to change it locally so you don't have to wait for the PR.
I also removed the spaces before the first \d
and before )?
Thanks Mate. I hope the update happens soon.
Ok, so here's how you can change it locally: First you should install the file explorer add-on in the Add-On stored if you didn't already. Then follow this tutorial to edit your blueprint locally.
In the blueprint navigate to line 482 and 486 (Might vary for you) and change all the regex strings to not contain ANY whitespaces aka Spaces and newlines. Then save the .yaml file and restart Home Assistant(Honestly don't know if thats necessary).
If you still need help doing it, feel free to ask.
Thanks for this fix in the regex @ZtormTheCat. Worked like a charm.
Blueprint name
Controller - IKEA E1812 TRÅDFRI Shortcut button
Home Assistant Core Version
2023.11.3
Home Assistant Installation Type
Home Assistant Operating System
Description
I imported the Ikea shortcut button blueprint and set it up everything works as expected, except double click. Attached screenshots of setup with error. I having configured the device using zigbee 2 mqtt setup.
Automation YAML config
To Reproduce
Import blueprint. Setup as image below. Run.
Expected behavior
Double click should toggle switch.
Actual Behaviour
Nothing.
Additional Details
Screenshots
Additional context
No response