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

Fix long press up/down for ikea_e2001_e2002.yaml #411

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

LewisSpring
Copy link

@LewisSpring LewisSpring commented Sep 12, 2022

Breaking change

Shouldn't be a breaking change for end users.

Proposed change*

Works towards resolving #399, fixes for long pressing the up and down buttons. Update 2022-12-13 Also fixes left and right hold too.

Strikethrough 2022-12-13 Does NOT include release action fixes as detailed here (See Note 2). If someone could work out how to implement that would be appreciated - I wasn't entirely sure how to do it myself.

Checklist*

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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 12, 2022

Hey @LewisSpring, 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!

@da2x
Copy link

da2x commented Sep 14, 2022

This patch fixes long pressing the up and down buttons on my e2002 device.

@LewisSpring
Copy link
Author

This patch fixes long pressing the up and down buttons on my e2002 device.

That's great news. Do you have issues with the "hold actions" not stopping? I'm experiencing that right now, as a result of me personally not being able to implement the "release action" fix.

@LewisSpring
Copy link
Author

LewisSpring commented Dec 13, 2022

Updated pull request with @lsismeiro's changes.
#399 (comment)
Myself and @simon-mettler have tested it and it works as expected.

FYI: The version number in the description of the blueprint has been changed to reflect the deviation from the released version.

@dunxd
Copy link

dunxd commented Feb 3, 2023

The changes in this PR are working great for me now. Finally can reset my lights with a double click without losing the ability to dim.

@koorool
Copy link

koorool commented Apr 19, 2023

@LewisSpring
Consider splitting this PR into two to increase chance of being approved and merged. First commit updates quite a lot of thing and not clear how it fixes any issue.

Second commit actually updates name of events and should be trivial to review, test and will probably get approved and merged.

Anyway, thanks for your work!

@LewisSpring
Copy link
Author

LewisSpring commented Apr 19, 2023

@LewisSpring Consider splitting this PR into two to increase chance of being approved and merged. First commit updates quite a lot of thing and not clear how it fixes any issue.

Second commit actually updates name of events and should be trivial to review, test and will probably get approved and merged.

Anyway, thanks for your work!

Hi @koorool, That's a good proposal.

I'm not sure what the first commit actually changes to be honest. It was quite a while ago(!)
Seems like it's been prettified or similar. I will see if @lsismeiro 's changes on their own with a copy from main works.

Edit: I as far as I can tell, I only changed the button press actions.
I will make a third commit that uses the original YAML from main, and update it with the changes me and @lsismeiro 's changes.
As nothing significant is changed, I am comfortable with not creating a new pull.

Pulled from main and updated with @lsismeiro 's changes.

FYI: version number changed for clarity
@koorool
Copy link

koorool commented Apr 21, 2023

Thank for your update. Installed and tested on my E2002 controllers, all works as expected.

Seems like there is a bigger PR that fixes that issue for most controllers (apparently it's not E2001/E2002 specific): #314

And there was some activity from repo author, so there is a chance it will get merged.

Regardless, thank you for your work!

@LewisSpring
Copy link
Author

Thank for your update. Installed and tested on my E2002 controllers, all works as expected.

Seems like there is a bigger PR that fixes that issue for most controllers (apparently it's not E2001/E2002 specific): #314

And there was some activity from repo author, so there is a chance it will get merged.

Regardless, thank you for your work!

You're welcome. Same here - no issues I can find.

I wasn't aware of that pull and activity. That's good news too.

@lsismeiro
Copy link

lsismeiro commented Apr 23, 2023

Hi all, just to be sure that the changes I made and that work, as already proved by other people besides me, are not missing. Here is the diff between the latest working code from the repository with the help fix (#378) and my own changes:

--- ikea_e2001_e2002.yaml.orig_new	2022-12-10 18:04:01.630304100 +0000
+++ ikea_e2001_e2002.yaml	2022-12-10 17:47:36.643041900 +0000
@@ -334,25 +334,25 @@ variables:
       button_left_long:
       - hold_3329_0
       button_left_release:
-      - release_1365
+      - release
       button_right_short:
       - press_256_13_0
       button_right_long:
       - hold_3328_0
       button_right_release:
-      - release_-27903
+      - release
       button_up_short:
       - 'on'
       button_up_long:
-      - move_with_on_off_0_83
+      - move_with_on_off_MoveMode.Up_83
       button_up_release:
-      - stop
+      - stop_with_on_off
       button_down_short:
       - 'off'
       button_down_long:
-      - move_1_83
+      - move_MoveMode.Down_83_bitmap8.0_bitmap8.0
       button_down_release:
-      - stop
+      - stop_with_on_off
     zigbee2mqtt:
       button_left_short:
       - arrow_left_click
@@ -496,7 +496,8 @@ action:
             sequence: !input action_button_left_long
       default: !input action_button_left_long
   - conditions:
-    - '{{ trigger_action | string in button_left_release }}'
+    - '{% if integration_id == "zha" %} {{ trigger_action[:7] | string in button_left_release }}
+      {% else %} {{ trigger_action | string in button_left_release }} {% endif %}'
     - '{{ not integration_id in integrations_with_prev_event_storage or last_controller_event
       | string in button_left_long }}'
     sequence:
@@ -560,7 +561,8 @@ action:
             sequence: !input action_button_right_long
       default: !input action_button_right_long
   - conditions:
-    - '{{ trigger_action | string in button_right_release }}'
+    - '{% if integration_id == "zha" %} {{ trigger_action[:7] | string in button_right_release }}
+      {% else %} {{ trigger_action | string in button_right_release }} {% endif %}'
     - '{{ not integration_id in integrations_with_prev_event_storage or last_controller_event
       | string in button_right_long }}'
     sequence:

Regards, Luis Sismeiro

@LewisSpring
Copy link
Author

LewisSpring commented Apr 23, 2023

Hi all, just to be sure that the changes I made and that work, as already proved by other people besides me, are not missing. Here is the diff between the latest working code from the repository with the help fix (#378) and my own changes:
[...]
Regards, Luis Sismeiro

Hey Luis, I am now aware of that change. I will update the pull with these changes. Thank you!

FYI: version number changed for clarity.
Direct copy of changes from https://github.com/lsismeiro/awesome-ha-blueprints. Future changes for this pull request will be mirrored from that fork.
Includes fixes for button actions and space evaluation post 2023.5.0.
Minimum version is 2023.5.0
@AHoran
Copy link

AHoran commented Jul 2, 2023

With the latest version of this PR, my long press down doesn't actually dim the light. Long up will increase brightness. Up and down work for on/off. With an e2002.
When I long press I see new values going into the helper. {"a":"move_MoveMode.Down_83_0_0","t":1688272844.479248} followed by {"a":"stop_0_0","t":1688272844.572418} on release.

LewisSpring and others added 3 commits July 4, 2023 00:59
…with @AHoran fixes for Long Button Down Actions

Co-authored-by: Adam Horan <ahoran@gmail.com>
Bump min_version to 2023.6.0 due to home-assistant/core#93860
Older versions appear to use different actions.
@rofo69
Copy link

rofo69 commented Jul 18, 2023

Line 324 is incorrect.
This:
button_down_long: [move_MoveMode.Down_83_bitmap8.0_bitmap8.0]

Should be changed to this:
button_down_long: [move_MoveMode.Down_83_0_0]

Some change in ZHA was made in a recent HA update that also broke another Ikea switch (The two button dimmer)

@LewisSpring
Copy link
Author

LewisSpring commented Jul 19, 2023

Line 324 is incorrect. This: button_down_long: [move_MoveMode.Down_83_bitmap8.0_bitmap8.0]

Should be changed to this: button_down_long: [move_MoveMode.Down_83_0_0]

Some change in ZHA was made in a recent HA update that also broke another Ikea switch (The two button dimmer)

Hi @rofo69
After checking my remote, it does appear the down hold action does not release.
Is this the same issue you experienced and fixed with this?

I will put your changes into a gist and test.
If anyone else could test this that would be appreciated.

Hi @rofo69, It appears this fix is already in place
https://github.com/LewisSpring/awesome-ha-blueprints/blob/380130b3a8b87037402b0f1da55e93635737804f/blueprints/controllers/ikea_e2001_e2002/ikea_e2001_e2002.yaml#L325

I'm still experiencing the aforementioned "down hold action does not release" issue with this fix.

@LewisSpring
Copy link
Author

Hi all,
Event integration has just been released as part of 2023.8.0.
https://www.home-assistant.io/integrations/event

If ZHA IKEA remotes move to this integration, We would need a new automation, but this looks like a really positive move.

Current methods should remain to work for the foreseeable future, I assume.

Fix Down Release command
Add note about E2201 support
Copy link
Author

@LewisSpring LewisSpring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @lsismeiro
I have made these changes to the PR.
Would you like me to create a pull request to your repo or otherwise merge these changes to keep it in sync?

Until then, I have removed the "Copied from with no modification:" tag.
Once these changes are merged, I will probably refer people to your repository's copy instead and make PRs to #411 and your repo simultaneously

Cheers mate

@lsismeiro
Copy link

Hi, I didn't find the time yet to check the changes. As soon as I have some time and restore the files of my dev tree I can take a look. Regards, Luis Sismeiro

@lsismeiro
Copy link

Hi, I didn't find the time yet to check the changes. As soon as I have some time and restore the files of my dev tree I can take a look. Regards, Luis Sismeiro

I updated the repository with the changes on the main branch, I think it is OK to add it as a blueprint using the HA GUI:
https://github.com/lsismeiro/awesome-ha-blueprints

@LewisSpring
Copy link
Author

Hi, I didn't find the time yet to check the changes. As soon as I have some time and restore the files of my dev tree I can take a look. Regards, Luis Sismeiro

I updated the repository with the changes on the main branch, I think it is OK to add it as a blueprint using the HA GUI: https://github.com/lsismeiro/awesome-ha-blueprints

Cheers Luis, will put a post up

No changes to code of blueprint. Updated description ONLY to reflect host repository change
@shaulbarlev
Copy link

Great work! thank you.
Why isn't this merged?

@LewisSpring
Copy link
Author

Unfortunately EPMatt has not been active on the project so we as a community are unable to do so.

Please check the GitHub repository I linked above, where we are updating the blueprints as a community effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants