-
-
Notifications
You must be signed in to change notification settings - Fork 29k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Z-Wave JS cover stop support #78723
Conversation
Hey there @home-assistant/z-wave, mind taking a look at this pull request as it has been labeled with an integration ( |
cafe141
to
867d97c
Compare
Please make sure the CI checks pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right solution. I am fairly certain the root of this problem is it looks like the original implementation was copied from the OZW integration code, which sent multiple open/close commands to workaround a bug in OZW (legacy zwave used a different API so it doesn't have this same code).
The desired Z-Wave command to stop an ongoing multilevel-switch transition is the Multilevel Switch CC Stop Level Command. Any one of the open/up/close/down values set to a False
value will result in the stop level command. If there's an Up value, then there's always a Down, Open and Close, etc, so you just need to find one them, e.g. On, Up, Open, etc.
All possible switch types are listed here. Each X/Y
entry generates separate "X" and "Y" value IDs.
Another approach to finding a value would be to search all values and find the first that has metadata cc_specific.switch_type
(or however the Python lib represents it), and use that one. Or, one could just use the CC API instead (see invoke_cc_api used elsewhere) and manually call the stopLevelChange
instead, but you'd also need to check for support.
In summary, the solution should probably be to just remove the duplicate set_value. Your change effectively does this because it returns on the first check.
If you're unsure of how these properties are supposed to work (and don't take my word for it), I would confirm with the node-zwave-js project.
Hopefully I can get some feedback from others that have worked with covers about the |
7b2fb36
to
6b2754f
Compare
Changes are up! Much simpler approach calling |
5be5c4d
to
4003d3b
Compare
@kpine are you happy with this change? |
Technically, looks fine to me. The "stopLevelChange" command is mandatory for all devices that support the multilevel switch CC, which all the (non-barrier) covers are, so there's no issue using it. The only thing is that by using the CC API it deviates from the convention (value ID API) used elsewhere in the integration, so not sure if that is a problem for you. I think the same solution would be achieved by just deleting the usage of the |
Only set one cover property that will send the Multilevel Switch CC Stop Level command.
4003d3b
to
77c4512
Compare
@MartinHjelmare The changes have been simplified to just remove the problematic extra stop. |
Thanks! Please solve the lint errors. |
Pushed a fix for the linter warnings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Co-authored-by: Franck Nijhof <git@frenck.dev>
Proposed change
This change fixes issues stopping covers (blinds) I was having with my home setup. The Z-Wave JS integration would blindly set the Up/Down property twice, causing the blinds to move again. The integration will now only stop one direction which will stop the cover regardless of actual direction of travel.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: