Use correct state attribute for alarmdecoder binary sensor (#54286)
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>pull/54356/head
parent
511af66b22
commit
a54ee7b366
|
@ -111,13 +111,13 @@ class AlarmDecoderBinarySensor(BinarySensorEntity):
|
|||
def _fault_callback(self, zone):
|
||||
"""Update the zone's state, if needed."""
|
||||
if zone is None or int(zone) == self._zone_number:
|
||||
self._attr_state = 1
|
||||
self._attr_is_on = True
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _restore_callback(self, zone):
|
||||
"""Update the zone's state, if needed."""
|
||||
if zone is None or (int(zone) == self._zone_number and not self._loop):
|
||||
self._attr_state = 0
|
||||
self._attr_is_on = False
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def _rfx_message_callback(self, message):
|
||||
|
@ -125,7 +125,7 @@ class AlarmDecoderBinarySensor(BinarySensorEntity):
|
|||
if self._rfid and message and message.serial_number == self._rfid:
|
||||
rfstate = message.value
|
||||
if self._loop:
|
||||
self._attr_state = 1 if message.loop[self._loop - 1] else 0
|
||||
self._attr_is_on = bool(message.loop[self._loop - 1])
|
||||
attr = {CONF_ZONE_NUMBER: self._zone_number}
|
||||
if self._rfid and rfstate is not None:
|
||||
attr[ATTR_RF_BIT0] = bool(rfstate & 0x01)
|
||||
|
@ -150,5 +150,5 @@ class AlarmDecoderBinarySensor(BinarySensorEntity):
|
|||
message.channel,
|
||||
message.value,
|
||||
)
|
||||
self._attr_state = message.value
|
||||
self._attr_is_on = bool(message.value)
|
||||
self.schedule_update_ha_state()
|
||||
|
|
Loading…
Reference in New Issue