Skip to content

Commit

Permalink
Update rokuecp to 0.4.0 (home-assistant#35436)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctalkington authored May 10, 2020
1 parent 497c01c commit c69d494
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
15 changes: 14 additions & 1 deletion homeassistant/components/roku/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.util.dt import utcnow

from .const import (
ATTR_IDENTIFIERS,
Expand Down Expand Up @@ -100,14 +101,26 @@ def __init__(
"""Initialize global Roku data updater."""
self.roku = Roku(host=host, session=async_get_clientsession(hass))

self.full_update_interval = timedelta(minutes=15)
self.last_full_update = None

super().__init__(
hass, _LOGGER, name=DOMAIN, update_interval=SCAN_INTERVAL,
)

async def _async_update_data(self) -> Device:
"""Fetch data from Roku."""
full_update = self.last_full_update is None or utcnow() >= (
self.last_full_update + self.full_update_interval
)

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:
raise UpdateFailed(f"Invalid response from API: {error}")

Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/roku/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"domain": "roku",
"name": "Roku",
"documentation": "https://www.home-assistant.io/integrations/roku",
"requirements": ["rokuecp==0.3.2"],
"requirements": ["rokuecp==0.4.0"],
"ssdp": [
{
"st": "roku:ecp",
Expand Down
2 changes: 1 addition & 1 deletion requirements_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1859,7 +1859,7 @@ rjpl==0.3.5
rocketchat-API==0.6.1

# homeassistant.components.roku
rokuecp==0.3.2
rokuecp==0.4.0

# homeassistant.components.roomba
roombapy==1.5.3
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ rflink==0.0.52
ring_doorbell==0.6.0

# homeassistant.components.roku
rokuecp==0.3.2
rokuecp==0.4.0

# homeassistant.components.roomba
roombapy==1.5.3
Expand Down

0 comments on commit c69d494

Please sign in to comment.