Skip to content

Commit

Permalink
verisure configurable polling (#17144)
Browse files Browse the repository at this point in the history
  • Loading branch information
persandstrom committed Oct 4, 2018
1 parent 52ff232 commit b55c7a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion homeassistant/components/verisure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
CONF_SMARTPLUGS = 'smartplugs'
CONF_THERMOMETERS = 'thermometers'
CONF_SMARTCAM = 'smartcam'
CONF_POLLING_RATE = 'polling_rate'

DOMAIN = 'verisure'

Expand All @@ -53,6 +54,8 @@
vol.Optional(CONF_SMARTPLUGS, default=True): cv.boolean,
vol.Optional(CONF_THERMOMETERS, default=True): cv.boolean,
vol.Optional(CONF_SMARTCAM, default=True): cv.boolean,
vol.Optional(CONF_POLLING_RATE, default=1): vol.All(
vol.Coerce(int), vol.Range(min=1)),
}),
}, extra=vol.ALLOW_EXTRA)

Expand All @@ -66,6 +69,8 @@ def setup(hass, config):
import verisure
global HUB
HUB = VerisureHub(config[DOMAIN], verisure)
HUB.update_overview = Throttle(timedelta(
minutes=config[DOMAIN][CONF_POLLING_RATE]))(HUB.update_overview)
if not HUB.login():
return False
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP,
Expand Down Expand Up @@ -140,7 +145,6 @@ def set_giid(self):
return False
return True

@Throttle(timedelta(seconds=60))
def update_overview(self):
"""Update the overview."""
try:
Expand Down

0 comments on commit b55c7a5

Please sign in to comment.