mirror of
https://github.com/home-assistant/core.git
synced 2025-06-25 07:27:08 +00:00
Call async_write_ha_state after ring update (#125096)
Use async_write_ha_state after ring update
This commit is contained in:
parent
df4bd721b5
commit
1b1c1c2a55
@ -81,6 +81,8 @@ class RingCam(RingEntity[RingDoorBell], Camera):
|
|||||||
history_data = self._device.last_history
|
history_data = self._device.last_history
|
||||||
if history_data:
|
if history_data:
|
||||||
self._last_event = history_data[0]
|
self._last_event = history_data[0]
|
||||||
|
# will call async_update to update the attributes and get the
|
||||||
|
# video url from the api
|
||||||
self.async_schedule_update_ha_state(True)
|
self.async_schedule_update_ha_state(True)
|
||||||
else:
|
else:
|
||||||
self._last_event = None
|
self._last_event = None
|
||||||
@ -183,7 +185,7 @@ class RingCam(RingEntity[RingDoorBell], Camera):
|
|||||||
|
|
||||||
await self._device.async_set_motion_detection(new_state)
|
await self._device.async_set_motion_detection(new_state)
|
||||||
self._attr_motion_detection_enabled = new_state
|
self._attr_motion_detection_enabled = new_state
|
||||||
self.async_schedule_update_ha_state(False)
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_enable_motion_detection(self) -> None:
|
async def async_enable_motion_detection(self) -> None:
|
||||||
"""Enable motion detection in the camera."""
|
"""Enable motion detection in the camera."""
|
||||||
|
@ -86,7 +86,7 @@ class RingLight(RingEntity[RingStickUpCam], LightEntity):
|
|||||||
|
|
||||||
self._attr_is_on = new_state == OnOffState.ON
|
self._attr_is_on = new_state == OnOffState.ON
|
||||||
self._no_updates_until = dt_util.utcnow() + SKIP_UPDATES_DELAY
|
self._no_updates_until = dt_util.utcnow() + SKIP_UPDATES_DELAY
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the light on for 30 seconds."""
|
"""Turn the light on for 30 seconds."""
|
||||||
|
@ -87,7 +87,7 @@ class SirenSwitch(BaseRingSwitch):
|
|||||||
|
|
||||||
self._attr_is_on = new_state > 0
|
self._attr_is_on = new_state > 0
|
||||||
self._no_updates_until = dt_util.utcnow() + SKIP_UPDATES_DELAY
|
self._no_updates_until = dt_util.utcnow() + SKIP_UPDATES_DELAY
|
||||||
self.async_schedule_update_ha_state()
|
self.async_write_ha_state()
|
||||||
|
|
||||||
async def async_turn_on(self, **kwargs: Any) -> None:
|
async def async_turn_on(self, **kwargs: Any) -> None:
|
||||||
"""Turn the siren on for 30 seconds."""
|
"""Turn the siren on for 30 seconds."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user