Skip to content

Commit 6213b43

Browse files
committed
fix: contact-state value format (#1373)
1 parent 0f65635 commit 6213b43

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

custom_components/xiaomi_home/binary_sensor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ async def async_setup_entry(
7070
for miot_device in device_list:
7171
if miot_device.miot_client.display_binary_bool:
7272
for prop in miot_device.prop_list.get('binary_sensor', []):
73-
new_entities.append(BinarySensor(
74-
miot_device=miot_device, spec=prop))
73+
new_entities.append(
74+
BinarySensor(miot_device=miot_device, spec=prop))
7575

7676
if new_entities:
7777
async_add_entities(new_entities)
@@ -90,7 +90,7 @@ def __init__(self, miot_device: MIoTDevice, spec: MIoTSpecProperty) -> None:
9090
def is_on(self) -> bool:
9191
"""On/Off state. True if the binary sensor is on, False otherwise."""
9292
if self.spec.name == 'contact-state':
93-
return self._value is False
93+
return bool(self._value) is False
9494
elif self.spec.name == 'occupancy-status':
9595
return bool(self._value)
9696
return self._value is True

0 commit comments

Comments
 (0)