mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Update rokuecp to 0.4.0 (#35436)
This commit is contained in:
parent
497c01c651
commit
c69d4943a5
@ -18,6 +18,7 @@ from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
|||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
|
||||||
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
from .const import (
|
from .const import (
|
||||||
ATTR_IDENTIFIERS,
|
ATTR_IDENTIFIERS,
|
||||||
@ -100,14 +101,26 @@ class RokuDataUpdateCoordinator(DataUpdateCoordinator):
|
|||||||
"""Initialize global Roku data updater."""
|
"""Initialize global Roku data updater."""
|
||||||
self.roku = Roku(host=host, session=async_get_clientsession(hass))
|
self.roku = Roku(host=host, session=async_get_clientsession(hass))
|
||||||
|
|
||||||
|
self.full_update_interval = timedelta(minutes=15)
|
||||||
|
self.last_full_update = None
|
||||||
|
|
||||||
super().__init__(
|
super().__init__(
|
||||||
hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL,
|
hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def _async_update_data(self) -> Device:
|
async def _async_update_data(self) -> Device:
|
||||||
"""Fetch data from Roku."""
|
"""Fetch data from Roku."""
|
||||||
|
full_update = self.last_full_update is None or utcnow() >= (
|
||||||
|
self.last_full_update + self.full_update_interval
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return await self.roku.update()
|
data = await self.roku.update(full_update=full_update)
|
||||||
|
|
||||||
|
if full_update:
|
||||||
|
self.last_full_update = utcnow()
|
||||||
|
|
||||||
|
return data
|
||||||
except RokuError as error:
|
except RokuError as error:
|
||||||
raise UpdateFailed(f"Invalid response from API: {error}")
|
raise UpdateFailed(f"Invalid response from API: {error}")
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"domain": "roku",
|
"domain": "roku",
|
||||||
"name": "Roku",
|
"name": "Roku",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/roku",
|
"documentation": "https://www.home-assistant.io/integrations/roku",
|
||||||
"requirements": ["rokuecp==0.3.2"],
|
"requirements": ["rokuecp==0.4.0"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"st": "roku:ecp",
|
"st": "roku:ecp",
|
||||||
|
@ -1859,7 +1859,7 @@ rjpl==0.3.5
|
|||||||
rocketchat-API==0.6.1
|
rocketchat-API==0.6.1
|
||||||
|
|
||||||
# homeassistant.components.roku
|
# homeassistant.components.roku
|
||||||
rokuecp==0.3.2
|
rokuecp==0.4.0
|
||||||
|
|
||||||
# homeassistant.components.roomba
|
# homeassistant.components.roomba
|
||||||
roombapy==1.5.3
|
roombapy==1.5.3
|
||||||
|
@ -747,7 +747,7 @@ rflink==0.0.52
|
|||||||
ring_doorbell==0.6.0
|
ring_doorbell==0.6.0
|
||||||
|
|
||||||
# homeassistant.components.roku
|
# homeassistant.components.roku
|
||||||
rokuecp==0.3.2
|
rokuecp==0.4.0
|
||||||
|
|
||||||
# homeassistant.components.roomba
|
# homeassistant.components.roomba
|
||||||
roombapy==1.5.3
|
roombapy==1.5.3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user