mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-15 05:50:43 +08:00
fix: revert value of door and windows sensor with binary sensor class
fix: revert value of door and windows sensor with binary sensor class Binary sensor class in Home Assistant uses true to indicate open, which is opposite of Xiaomi Home. This commit reverts the value of door and windows sensor to make them the same.
This commit is contained in:
parent
162f943924
commit
9cc2c52d44
@ -88,4 +88,7 @@ class BinarySensor(MIoTPropertyEntity, BinarySensorEntity):
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""On/Off state. True if the binary sensor is on, False otherwise."""
|
||||
"""If it is a door and windows sensor, revert the value."""
|
||||
if self._attr_device_class == 'door':
|
||||
return not (self._value is True)
|
||||
return self._value is True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user