1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Fix for sun if condition

This commit is contained in:
Philip Lundrigan
2016-01-03 00:36:22 -07:00
parent cf1f9a29bf
commit c9ff0ab7eb
2 changed files with 55 additions and 16 deletions

View File

@@ -82,21 +82,21 @@ def if_action(hass, config):
if before is None:
before_func = lambda: None
elif before == EVENT_SUNRISE:
before_func = lambda: sun.next_rising_utc(hass) + before_offset
before_func = lambda: sun.next_rising(hass) + before_offset
else:
before_func = lambda: sun.next_setting_utc(hass) + before_offset
before_func = lambda: sun.next_setting(hass) + before_offset
if after is None:
after_func = lambda: None
elif after == EVENT_SUNRISE:
after_func = lambda: sun.next_rising_utc(hass) + after_offset
after_func = lambda: sun.next_rising(hass) + after_offset
else:
after_func = lambda: sun.next_setting_utc(hass) + after_offset
after_func = lambda: sun.next_setting(hass) + after_offset
def time_if():
""" Validate time based if-condition """
now = dt_util.utcnow()
now = dt_util.now()
before = before_func()
after = after_func()