Use const.SUN_EVENT_* more (#18039)

This commit is contained in:
Ville Skyttä authored and Daniel Høyer Iversen committed 2018-10-31 09:10:28 +01:00
1 parent dcc46226ee
commit 9c840f93f0
11 files changed
+82 -67

No files matched your search

+4 -3
View File
@@ -18,7 +18,7 @@ from homeassistant.components.light import (
from homeassistant.components.switch import DOMAIN, SwitchDevice
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_NAME, CONF_PLATFORM, CONF_LIGHTS, CONF_MODE,
SERVICE_TURN_ON)
SERVICE_TURN_ON, SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET)
from homeassistant.helpers.event import track_time_interval
from homeassistant.helpers.sun import get_astral_event_date
from homeassistant.util import slugify
@@ -200,7 +200,7 @@ class FluxSwitch(SwitchDevice):
if now is None:
now = dt_now()
sunset = get_astral_event_date(self.hass, 'sunset', now.date())
sunset = get_astral_event_date(self.hass, SUN_EVENT_SUNSET, now.date())
start_time = self.find_start_time(now)
stop_time = self.find_stop_time(now)
@@ -283,7 +283,8 @@ class FluxSwitch(SwitchDevice):
hour=self._start_time.hour, minute=self._start_time.minute,
second=0)
else:
sunrise = get_astral_event_date(self.hass, 'sunrise', now.date())
sunrise = get_astral_event_date(self.hass, SUN_EVENT_SUNRISE,
now.date())
return sunrise
def find_stop_time(self, now):