Fix SIA availability (#65509)

pull/65534/head
Eduard van Valkenburg 2022-02-03 14:29:12 +01:00 committed by GitHub
parent 4946f271c9
commit 0ff93759d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -38,3 +38,4 @@ KEY_MOISTURE: Final = "moisture"
KEY_POWER: Final = "power"
PREVIOUS_STATE: Final = "previous_state"
AVAILABILITY_EVENT_CODE: Final = "RP"

View File

@ -14,7 +14,7 @@ from homeassistant.helpers.event import async_call_later
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.helpers.typing import StateType
from .const import DOMAIN, SIA_EVENT, SIA_HUB_ZONE
from .const import AVAILABILITY_EVENT_CODE, DOMAIN, SIA_EVENT, SIA_HUB_ZONE
from .utils import get_attr_from_sia_event, get_unavailability_interval
_LOGGER = logging.getLogger(__name__)
@ -105,7 +105,7 @@ class SIABaseEntity(RestoreEntity):
return
self._attr_extra_state_attributes.update(get_attr_from_sia_event(sia_event))
state_changed = self.update_state(sia_event)
if state_changed:
if state_changed or sia_event.code == AVAILABILITY_EVENT_CODE:
self.async_reset_availability_cb()
self.async_write_ha_state()