Invert ISY994 dusk/dawn sensors to match expected state (#92035)

This commit is contained in:
shbatm 2023-04-25 17:15:48 -05:00 committed by GitHub
parent 2d510bfe0d
commit 969db343bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -400,12 +400,18 @@ class ISYInsteonBinarySensorEntity(ISYBinarySensorEntity):
Insteon leak sensors set their primary node to On when the state is Insteon leak sensors set their primary node to On when the state is
DRY, not WET, so we invert the binary state if the user indicates DRY, not WET, so we invert the binary state if the user indicates
that it is a moisture sensor. that it is a moisture sensor.
Dusk/Dawn sensors set their node to On when DUSK, not light detected,
so this is inverted as well.
""" """
if self._computed_state is None: if self._computed_state is None:
# Do this first so we don't invert None on moisture sensors # Do this first so we don't invert None on moisture or light sensors
return None return None
if self.device_class == BinarySensorDeviceClass.MOISTURE: if self.device_class in (
BinarySensorDeviceClass.LIGHT,
BinarySensorDeviceClass.MOISTURE,
):
return not self._computed_state return not self._computed_state
return self._computed_state return self._computed_state