Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug - Philips Hue Dimmer V2 - Double Press not recognized #576

Open
1 task
TTvanWillegen opened this issue Nov 11, 2023 · 3 comments · May be fixed by #577
Open
1 task

Bug - Philips Hue Dimmer V2 - Double Press not recognized #576

TTvanWillegen opened this issue Nov 11, 2023 · 3 comments · May be fixed by #577
Labels
blueprint An issue related to a blueprint bug Something isn't working

Comments

@TTvanWillegen
Copy link

Blueprint name

EPMatt/awesome-ha-blueprints/blob/main/blueprints/controllers/philips_929002398602/philips_929002398602.yaml#L389

Home Assistant Core Version

2023.11.2

Home Assistant Installation Type

Home Assistant Operating System

Description

Hi there,

I have just re-paired all my zigbee devices via Z2M using a sonoff controller as they failed recently.
However, now that it almost all works, the double press doesn't.

I've been able to trace this back to a mismatch in the regex used in the calculation of the trigger_delta and the value stored in the last_action helper fields.

The regex currently is as follows: Line 389

^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$
while the helper field doesn' t contain whitespace:
{"a":"off_press_release","t":1699726460.746302}

A matching regex (for me) is as follows:
^\{((\"a\": \".*\"|\"t\":\d+\.\d+)(,)?){2}\}$
This regex removes the whitespace after the semicolon in the t part as well as after the separating comma in the center.

Automation YAML config

For use in Home Assistant's Developer tools:

{%set helper_last_controller_event = 'input_text.last_hue_dimmer_switch_action' %}

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

To Reproduce

For use in Home Assistant's Developer tools:

{%set helper_last_controller_event = 'input_text.last_hue_dimmer_switch_action' %} <- change the input to match yours.

{{states(helper_last_controller_event) | regex_match("^\{((\"a\": \".*\"|\"t\": \d+\.\d+)(, )?){2}\}$")}} <- old regex
{{states(helper_last_controller_event) | regex_match("^\{((\"a\":\".*\"|\"t\":\d+\.\d+)(,)?){2}\}$")}} <- new regex

Expected behavior

The hue switch to emulate a double press event.

Actual Behaviour

Not triggering the double press path due to a mismatching Regex.

Additional Details

  • I'd like to help developing a fix for this issue.

Screenshots

No response

Additional context

No response

@TTvanWillegen TTvanWillegen added blueprint An issue related to a blueprint bug Something isn't working labels Nov 11, 2023
@hjone72
Copy link

hjone72 commented Nov 28, 2023

Life saver! Had just been trying to solve this issue. I isolated it down to the delta variable and then found your open issue here.

@acid115
Copy link

acid115 commented Dec 12, 2023

If you use deconz, then you have no double quoted value for the "a"-key.
a":2002,"t":1702413771.806498

So the right one is:
regex_match("^\{((\"a\":[\"]?.*[\"]?|\"t\":\d+\.\d+)(,)?){2}\}$")

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

@RassK
Copy link

RassK commented Feb 6, 2024

Seems exactly the same issue with IKEA E2001.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blueprint An issue related to a blueprint bug Something isn't working
Projects
None yet
4 participants