Retry keyset cloud (#12270)

* Use less threads in helpers.event tests

* Add helpers.event.async_call_later

* Cloud: retry fetching keyset
This commit is contained in:
Paulus Schoutsen authored and Pascal Vizeli committed 2018-02-10 11:40:24 +01:00
1 parent 134445f622
commit f2296e1ff8
6 files changed
+66 -40

No files matched your search

+9
View File
@@ -1,4 +1,5 @@
"""Helpers for listening to events."""
from datetime import timedelta
import functools as ft
from homeassistant.loader import bind_hass
@@ -219,6 +220,14 @@ track_point_in_utc_time = threaded_listener_factory(
async_track_point_in_utc_time)
@callback
@bind_hass
def async_call_later(hass, delay, action):
"""Add a listener that is called in <delay>."""
return async_track_point_in_utc_time(
hass, action, dt_util.utcnow() + timedelta(seconds=delay))
@callback
@bind_hass
def async_track_time_interval(hass, action, interval):