Bugfix segfault with new helper track_time_interval (#5222)

* Bugfix sigfault with new helper track_time_interval

* Add none init also to sunrise/sunset for consistance
pull/5035/merge
Pascal Vizeli 2017-01-08 14:06:15 +01:00 committed by Paulus Schoutsen
parent 41ef6228be
commit a65388e778
1 changed files with 4 additions and 0 deletions

View File

@ -135,6 +135,8 @@ track_point_in_utc_time = threaded_listener_factory(
def async_track_time_interval(hass, action, interval):
"""Add a listener that fires repetitively at every timedelta interval."""
remove = None
def next_interval():
"""Return the next interval."""
return dt_util.utcnow() + interval
@ -164,6 +166,7 @@ def async_track_sunrise(hass, action, offset=None):
"""Add a listener that will fire a specified offset from sunrise daily."""
from homeassistant.components import sun
offset = offset or timedelta()
remove = None
def next_rise():
"""Return the next sunrise."""
@ -199,6 +202,7 @@ def async_track_sunset(hass, action, offset=None):
"""Add a listener that will fire a specified offset from sunset daily."""
from homeassistant.components import sun
offset = offset or timedelta()
remove = None
def next_set():
"""Return next sunrise."""