Fix SIA availability (#65509)
This commit is contained in:
parent
4946f271c9
commit
0ff93759d0
2 changed files with 3 additions and 2 deletions
|
@ -38,3 +38,4 @@ KEY_MOISTURE: Final = "moisture"
|
||||||
KEY_POWER: Final = "power"
|
KEY_POWER: Final = "power"
|
||||||
|
|
||||||
PREVIOUS_STATE: Final = "previous_state"
|
PREVIOUS_STATE: Final = "previous_state"
|
||||||
|
AVAILABILITY_EVENT_CODE: Final = "RP"
|
||||||
|
|
|
@ -14,7 +14,7 @@ from homeassistant.helpers.event import async_call_later
|
||||||
from homeassistant.helpers.restore_state import RestoreEntity
|
from homeassistant.helpers.restore_state import RestoreEntity
|
||||||
from homeassistant.helpers.typing import StateType
|
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
|
from .utils import get_attr_from_sia_event, get_unavailability_interval
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -105,7 +105,7 @@ class SIABaseEntity(RestoreEntity):
|
||||||
return
|
return
|
||||||
self._attr_extra_state_attributes.update(get_attr_from_sia_event(sia_event))
|
self._attr_extra_state_attributes.update(get_attr_from_sia_event(sia_event))
|
||||||
state_changed = self.update_state(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_reset_availability_cb()
|
||||||
self.async_write_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue