Fix unknown values in onewire (#113731)

* Fix unknown values in onewire

* Update tests
This commit is contained in:
epenet 2024-03-18 10:12:46 +01:00 committed by Paulus Schoutsen
parent 6859bae0b1
commit 33678ff5a4
5 changed files with 17 additions and 9 deletions

View file

@ -143,6 +143,8 @@ class OneWireBinarySensor(OneWireEntity, BinarySensorEntity):
entity_description: OneWireBinarySensorEntityDescription
@property
def is_on(self) -> bool:
def is_on(self) -> bool | None:
"""Return true if sensor is on."""
if self._state is None:
return None
return bool(self._state)