awesome-ha-blueprints icon indicating copy to clipboard operation
awesome-ha-blueprints copied to clipboard

remove spaces to match new helper format in 2023.5

Open LordSushiPhoenix opened this issue 1 year ago • 27 comments

Thank you for taking the time to work on a Pull Request. Your contribution is really appreciated! :tada: Please don't delete any part of the template, since keeping the provided structure will help maintainers to review your work more rapidly.

Sections marked as * are required and need to be filled in.

Breaking change

If your PR contains a breaking change for existing users, it is important to describe what breaks, how to make it work again and why we did this. This section will be used to craft the changelog entry, after your PR gets approved and merged.

Note: Remove this section if this PR is NOT a breaking change.

May break compatibility with Home Assistant versions before 2023.5

Proposed change*

Describe the big picture of your changes here, and why your pull request should be accepted. If it fixes a bug or resolves a feature request, be sure to put closes #XXXX in this section to auto-close relevant issues.

Please note that for important and breaking changes it's always better to open an issue first for discussing the proposal.

Make sure to provide enough information so that your pull request can be reviewed.

The last controller event format has changed in 2023.5 and broken some controller automations. Removing spaces fixes it. Closes #544

https://github.com/EPMatt/awesome-ha-blueprints/issues/544#issuecomment-1536593604

Checklist*

  • [x] I followed sections of the Contribution Guidelines relevant to changes I'm proposing.
  • [x] I properly tested proposed changes on my system and confirm that they are working as expected.
  • [x] I formatted files with Prettier using the command npm run format before submitting my Pull Request.

LordSushiPhoenix avatar May 05 '23 20:05 LordSushiPhoenix

Hey @LordSushiPhoenix, thank you so much for your contribution! 🚀

🔄 We're currently running a few checks to make sure that everything is great with your contribution. If further actions need to be performed before your contribution can be reviewed, additional guidance will be provided to you in the next comment.

Results are coming soon, stay tuned!

github-actions[bot] avatar May 05 '23 20:05 github-actions[bot]

This change works for me on both of my systems, with E1743 controllers.

LaPe63 avatar May 08 '23 04:05 LaPe63

Ok so then what am I doing wrong?

I completely replaced the contents here: /config/blueprints/automation/EPMatt/ikea_e1743.yaml

I copied the raw conents of the e1743.yaml file posted by @LordSushiPhoenix overtop of the existing contents, saved, restarted home assistant, but no dice... am I doing something wrong?

tumtumsback avatar May 08 '23 14:05 tumtumsback

This change works for me on both of my systems, with E1743 controllers.

LaPe63 what is your secret ... I've tried everything, I can't get double press events working on my E1743 remotes in 2023.5+

tumtumsback avatar May 13 '23 15:05 tumtumsback

This change works for me on both of my systems, with E1743 controllers.

LaPe63 what is your secret ... I've tried everything, I can't get double press events working on my E1743 remotes in 2023.5+

Dont know, just made sure i had the latest version (2022.08.08) and then i edited the file directly under /config/blueprints/automation/EPMatt/ and removed the spaces in 6 places, and restarted HA. I did the same on ikea_e2001_e2002, and it also worked.

LaPe63 avatar May 15 '23 13:05 LaPe63

This change works for me on both of my systems, with E1743 controllers.

LaPe63 what is your secret ... I've tried everything, I can't get double press events working on my E1743 remotes in 2023.5+

Dont know, just made sure i had the latest version (2022.08.08) and then i edited the file directly under /config/blueprints/automation/EPMatt/ and removed the spaces in 6 places, and restarted HA. I did the same on ikea_e2001_e2002, and it also worked.

6 places? what do you mean by that ...

Also, what integration are you using -- Deconz, ZHA, or Z2M?

tumtumsback avatar May 15 '23 13:05 tumtumsback

I'm using Z2M.

LordSushiPhoenix avatar May 15 '23 13:05 LordSushiPhoenix

Hmm okay because my 1743s are joined via Deconz ... I wonder if there's something different there?

tumtumsback avatar May 15 '23 13:05 tumtumsback

Possibly, I've only ever used or tested Z2M. Does the string in your last event helper look like the ones in this comment? https://github.com/EPMatt/awesome-ha-blueprints/issues/544#issuecomment-1536593604

LordSushiPhoenix avatar May 15 '23 13:05 LordSushiPhoenix

Possibly, I've only ever used or tested Z2M. Does the string in your last event helper look like the ones in this comment? #544 (comment)

To test this, I'd have to snapshot (so I can rollback when doubletap breaks again), upgrade to 2023.5, and then test... I'll see what I can do later today.

tumtumsback avatar May 15 '23 13:05 tumtumsback

If you grab the string on 2023.5 that would at least validate whether or not the new regex matches it without rolling back.

LordSushiPhoenix avatar May 15 '23 13:05 LordSushiPhoenix

If you grab the string on 2023.5 that would at least validate whether or not the new regex matches it without rolling back.

10-4 // and where exactly would I be looking for this string -- in the Deconz logs?

tumtumsback avatar May 15 '23 13:05 tumtumsback

Right in home assistant, under the helpers tab. Find the input text helper used for the automation and copy the value.

LordSushiPhoenix avatar May 15 '23 14:05 LordSushiPhoenix

Hmm okay because my 1743s are joined via Deconz ... I wonder if there's something different there?

Hmm okay because my 1743s are joined via Deconz ... I wonder if there's something different there?

I'm also on z2M.

LaPe63 avatar May 15 '23 14:05 LaPe63

This change works for me on both of my systems, with E1743 controllers.

LaPe63 what is your secret ... I've tried everything, I can't get double press events working on my E1743 remotes in 2023.5+

Dont know, just made sure i had the latest version (2022.08.08) and then i edited the file directly under /config/blueprints/automation/EPMatt/ and removed the spaces in 6 places, and restarted HA. I did the same on ikea_e2001_e2002, and it also worked.

6 places? what do you mean by that ... I changed the line 280 and 281 to match the commit.

Also, what integration are you using -- Deconz, ZHA, or Z2M? Z2M.

LaPe63 avatar May 15 '23 14:05 LaPe63

Before 2023.5:

Successful Fan turn off:

Text 1 changed to {"trigger_action": "double_press", "last_triggered": "2023-05-15 09:37:31.006032-04:00"} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 9:37:31 AM - 5 hours ago Text 1 changed to {"trigger_action": 2002, "last_triggered": "2023-05-15 09:37:31.000759-04:00"} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 9:37:31 AM - 5 hours ago Text 1 changed to {"trigger_action": 2002, "last_triggered": "2023-05-15 09:37:30.200153-04:00"} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 9:37:30 AM - 5 hours ago

Successful Fan turn on:

Text 1 changed to {"trigger_action": "double_press", "last_triggered": "2023-05-15 09:37:26.105687-04:00"} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 9:37:26 AM - 5 hours ago Text 1 changed to {"trigger_action": 1002, "last_triggered": "2023-05-15 09:37:26.100899-04:00"} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 9:37:26 AM - 5 hours ago Text 1 changed to {"trigger_action": 1002, "last_triggered": "2023-05-15 09:37:25.300586-04:00"} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 9:37:25 AM - 5 hours ago

After 2023.5:

Unsuccessful Fan turn on(s):

Double press attempt #2

Text 1 changed to {"a":1002,"t":1684174588.065661} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 2:16:28 PM - 23 seconds ago Text 1 changed to {"a":1002,"t":1684174587.465954} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event'

Double press attempt #1

2:16:27 PM - 24 seconds ago Text 1 changed to {"a":1002,"t":1684174583.114406} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event' 2:16:23 PM - 28 seconds ago Text 1 changed to {"a":1002,"t":1684174582.609161} triggered by automation Bathroom - Doubletap - Fan triggered by event 'deconz_event'

tumtumsback avatar May 15 '23 18:05 tumtumsback

So regarding the above, I upgraded to 2023.5, then replaced the YAML with the fixed YAML, then restarted HA completely, and that's what I get.

Before 2023.5, you can see after two "1002" events, it then successfully triggers the "double_press" action to turn on the Fan.

After 2023.5, you can see the two "1002" events, but a "double_press" action never follows. And, I see the "1002" events appear to be crafted differently -- I see "a" now instead of "trigger_action" -- I guess the newer YAML has different conventions/coding in it...

tumtumsback avatar May 15 '23 18:05 tumtumsback

Assuming you were running the version of the blueprint yaml that's currently in main, I'm not sure why it works for you on 2022.4, but the yaml is trying to match the string "a":".*", i.e. "a":"1002" where the deconz events are stored as "a":1002. This probably has something to do with it since there are no quote characters to match.

LordSushiPhoenix avatar May 15 '23 19:05 LordSushiPhoenix

I was running an OLD version of the YAML. I implemented this blueprint well over a year ago, so that explains the different syntax.

But, this doesn't explain why the blueprint isn't picking up on double_press events...

On Mon, May 15, 2023 at 3:10 PM LordSushiPhoenix @.***> wrote:

Assuming you were running the version of the blueprint yaml that's currently in main, I'm not sure why it works for you on 2022.4, but the yaml is trying to match the string "a":".*", i.e. "a":"1002" but the deconz events are stored as "a":1002. This probably has something to do with it since there are no quote characters to match.

— Reply to this email directly, view it on GitHub https://github.com/EPMatt/awesome-ha-blueprints/pull/545#issuecomment-1548418750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOBYVLJBPWBAANRWZCTACNLXGJ5SDANCNFSM6AAAAAAXXSP2Z4 . You are receiving this because you commented.Message ID: @.***>

tumtumsback avatar May 15 '23 19:05 tumtumsback

This probably has something to do with it since there are no quote characters to match.

try removing the escaped quotation marks around the .* in both lines.

Edit: if your version of the yaml was old enough, it may also have been before the introduction of debouncing, you may need to play with the debounce and double press delay. FWIW a triple tap more reliably triggers the double tap action on both my e1743 and e2001 controllers when the double press delay is set to a sane value (double tap consistently triggers when it's set to 4000ms, but then you have to wait 4s for single press actions.)

LordSushiPhoenix avatar May 15 '23 19:05 LordSushiPhoenix

This probably has something to do with it since there are no quote characters to match.

try removing the escaped quotation marks around the .* in both lines.

Edit: if your version of the yaml was old enough, it may also have been before the introduction of debouncing, you may need to play with the debounce and double press delay. FWIW a triple tap more reliably triggers the double tap action on both my e1743 and e2001 controllers when the double press delay is set to a sane value (double tap consistently triggers when it's set to 4000ms, but then you have to wait 4s for single press actions.)

HOLY FLIP!

I removed the escaped quotation marks as you had suggested and it fricken worked.

tumtumsback avatar May 17 '23 21:05 tumtumsback

So I assume this YAML now needs to be updated again to fix the regex to work properly with deconz?

tumtumsback avatar May 17 '23 21:05 tumtumsback

Just wanted to add that this fixed long press issues for me with ZHA. There is indeed a difference between how HASS 2023.4.x and older would parse the messages. The new message format omits the spaces in the helper text.

anthonylavado avatar May 24 '23 19:05 anthonylavado

Any updates on this PR? Waiting for this fix to be merged ✌️

larsmathuseck avatar Jun 12 '23 21:06 larsmathuseck

This also fixes the E1744 indefinitely increasing/decreasing brightness levels

botrosco avatar Aug 31 '23 23:08 botrosco

Any updates on this PR? Waiting for this fix to be merged ✌️

Witth 48PR currently waiting, I wouldn't bet on that. I'm not sure @EPMatt still maintain, he seems absent from this project for few months but he seems to be active on some of his other github repo so I don't know what's up.. It's not an easy job to maintain "big" projects, he might be exausted or anything.. It would just be nice to know what's happening so everybody can move on with a fork or he can nominate other member of the community to help I guess.

Someone has oppenned an issue asking if the repo is really unmaintained/dead, noreply yet.. ( issue #554 )

arsenicks avatar Sep 03 '23 20:09 arsenicks

This probably has something to do with it since there are no quote characters to match.

try removing the escaped quotation marks around the .* in both lines. Edit: if your version of the yaml was old enough, it may also have been before the introduction of debouncing, you may need to play with the debounce and double press delay. FWIW a triple tap more reliably triggers the double tap action on both my e1743 and e2001 controllers when the double press delay is set to a sane value (double tap consistently triggers when it's set to 4000ms, but then you have to wait 4s for single press actions.)

HOLY FLIP!

I removed the escaped quotation marks as you had suggested and it fricken worked.

if anyone is curious as to how you should structure that string for deconz, here it is:

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

not gonna lie, it took me far too long to work this out - i don't know regex very well, and was having trouble translating the words you were all speaking into regex that actually worked haha

if you replace the regex in lines 439 and 440 (of the current file in main) with the above, it should start working for users with deconz integrations

collateral127 avatar Sep 13 '23 12:09 collateral127