-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
Reverse Motion Blinds tilt direction #149777
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
Conversation
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.
Pull Request Overview
This PR fixes the inverted tilt direction in the Motion Blinds integration to align with Home Assistant standards. The change ensures that tilt position 0 means closed/covering the window and 100 means open/letting light through, which is the opposite of the previous behavior.
Key changes:
- Reverses tilt position calculation using
100 - valueformula - Swaps open/close tilt commands (open now sets angle to 0, close sets to 180)
- Updates both angle-based and position-based tilt handling
- Adds return type annotations to constructor methods
Comments suppressed due to low confidence (2)
homeassistant/components/motion_blinds/cover.py:370
- Similar to the previous issue, the angle calculation should use the inverted tilt position before converting to device coordinates. The logic should be:
angle = (100 - kwargs[ATTR_TILT_POSITION]) * 180 / 100instead of calculating the angle first and then inverting it.
angle = kwargs[ATTR_TILT_POSITION]
homeassistant/components/motion_blinds/cover.py:387
- The angle calculation in async_set_absolute_position should also use the inverted position before converting to device coordinates:
angle = (100 - kwargs[ATTR_POSITION]) * 180 / 100
return
|
Is this ready for a review? |
|
@RyanMorash yes this is ready for review. |
RyanMorash
left a comment
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.
Looks good to me
|
|
||
| _restore_tilt = False | ||
|
|
||
| def __init__(self, coordinator, blind, device_class): |
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.
What about is_closed()and current_cover_position(), do they need reversing as well? If not then at least the docstring still seems wrong.
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.
It's only the tilt position that had the issue. current_cover_position is not affected. I'm unsure if the is_closed property is supposed to reflect both the current_cover_position and the current_cover_tilt_position.
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.
Then only the documentation should be fixed. I could not find anything on the question if tilt should be reflected in is_closed(), my personal opinion is no.
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.
@wollew the is_closed and current_cover_position were already reversed from the start.
This is because open and closed are more clearly defined for those states and I had a rollerblind for testing when I first wrote the code.
So no they do not need any changes.
abmantis
left a comment
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: Abílio Costa <[email protected]>
Breaking change
The tilt position of Motion Blinds devices has been corrected to allign with the Home Assistant standards.
The new tilt position will be: 0 = closed/covering the window opening, 100 = open/letting light through.
The previous tilt position can be converted to the new tilt postion as follows:
Any automations concerning Motion Blinds devices that use the current_tilt_position attribute or use tilt open/close will need to be adjusted.
Proposed change
The motion_blinds integration currently has its tilt direction reversed. This pull request accounts for the difference between the Home Assistant entity model and the Motionblinds implementation.
This PR will flip the tilt position according to new = 100 - old
Type of change
Additional information
Checklist
ruff format 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.To help with the load of incoming pull requests: