-
-
Notifications
You must be signed in to change notification settings - Fork 697
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 isActive for locks #3862
Fix isActive for locks #3862
Conversation
Lock entity should be active when locked, inactive otherwise
If you read the actual PR #3805 we listed it as a breaking change in #3836 because this makes the app more in line with what the frontend considers as active and we should actually match the frontend here. https://github.com/home-assistant/frontend/blob/dev/src/common/entity/state_active.ts#L40 |
I see. And I also understand the desire to simplify code, and to be in line with what the frontend is doing. But specifically for locks, and the tiles on Android, the resulting behavior is counter-productive. As mentioned, other home automation products display lock tiles as active when they are locked. Maybe the real fix would be to change the frontend logic that you linked to, as well? I would argue that a lock's purpose is to, well, lock things - so it's active when locked, and inactive when unlocked. |
Yes this would be the correct approach before we should accept this PR because we do base our logic on what HA users expect and not what the expectation is from other apps. That is also the reason why we link to frontend logic in several places so its easier for us to update and keep things in sync. This is also why we highlighted it as a breaking change as we are aware some users may not like it. |
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.
Just need to add a comment so we can remember why we explicitly changed the logic from the fronted.
You can also close your frontend PR too
common/src/main/java/io/homeassistant/companion/android/common/data/integration/Entity.kt
Show resolved
Hide resolved
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
Linked another issue to this PR, as the action will no longer be inverted if this is merged |
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 for the adding the comment. As the requested changes are now completed I will put this PR ready for review so we can merge it.
Summary
Lock entity should be active when locked, inactive otherwise
Screenshots
irrelevant
Link to pull request in Documentation repository
irrelevant
Any other notes
A recent PR (#3816) made changes to how different entities and their states are represented. This change caused the locks to be represented by active (on) tiles when unlocked, and inactive (off) tiles when locked. This new representation is counter-intuitive, and contradicts the lock representation in tiles provided by other home automation software (e.g. Google Home).
This PR reverts this change at its core (the logic of
isActive
for lock entities), while keeping the rest of the changes in #3816 intact.