mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +02:00
Ring camera fix (#30975)
* Fix ring camera entities * Reverted test refresh interval * Fix black errors
This commit is contained in:
parent
765b45c81b
commit
8fcd0e9a79
@ -51,8 +51,7 @@ class RingCam(RingEntityMixin, Camera):
|
||||
self._last_event = None
|
||||
self._last_video_id = None
|
||||
self._video_url = None
|
||||
self._utcnow = dt_util.utcnow()
|
||||
self._expires_at = self._utcnow - FORCE_REFRESH_INTERVAL
|
||||
self._expires_at = dt_util.utcnow() - FORCE_REFRESH_INTERVAL
|
||||
|
||||
async def async_added_to_hass(self):
|
||||
"""Register callbacks."""
|
||||
@ -80,7 +79,7 @@ class RingCam(RingEntityMixin, Camera):
|
||||
self._last_event = None
|
||||
self._last_video_id = None
|
||||
self._video_url = None
|
||||
self._expires_at = self._utcnow
|
||||
self._expires_at = dt_util.utcnow()
|
||||
self.async_write_ha_state()
|
||||
|
||||
@property
|
||||
@ -141,10 +140,8 @@ class RingCam(RingEntityMixin, Camera):
|
||||
if self._last_event["recording"]["status"] != "ready":
|
||||
return
|
||||
|
||||
if (
|
||||
self._last_video_id == self._last_event["id"]
|
||||
and self._utcnow <= self._expires_at
|
||||
):
|
||||
utcnow = dt_util.utcnow()
|
||||
if self._last_video_id == self._last_event["id"] and utcnow <= self._expires_at:
|
||||
return
|
||||
|
||||
try:
|
||||
@ -160,4 +157,4 @@ class RingCam(RingEntityMixin, Camera):
|
||||
if video_url:
|
||||
self._last_video_id = self._last_event["id"]
|
||||
self._video_url = video_url
|
||||
self._expires_at = FORCE_REFRESH_INTERVAL + self._utcnow
|
||||
self._expires_at = FORCE_REFRESH_INTERVAL + utcnow
|
||||
|
Loading…
Reference in New Issue
Block a user