Fix isActive for locks (#3862)

* Fix isActive for locks

Lock entity should be active when locked, inactive otherwise

* Added a comment to explain the change
This commit is contained in:
Lev Aronsky 2023-09-19 22:40:07 +03:00 committed by GitHub
parent 03e3cee8e3
commit a31cd2fdaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -829,7 +829,8 @@ fun <T> Entity<T>.isActive() = when {
(domain == "cover") -> state != "closed"
(domain in listOf("device_tracker", "person")) -> state != "not_home"
(domain == "lawn_mower") -> state in listOf("mowing", "error")
(domain == "lock") -> state != "locked"
// on Android, contrary to HA Frontend, a lock is considered active when locked
(domain == "lock") -> state == "locked"
(domain == "media_player") -> state != "standby"
(domain == "vacuum") -> state !in listOf("idle", "docked", "paused")
(domain == "plant") -> state == "problem"