Minor code cleanup
This commit is contained in:
parent
5f4ddfe92c
commit
f7522c6ed3
3 changed files with 5 additions and 5 deletions
|
@ -103,5 +103,5 @@ class HueTrigger(object):
|
|||
|
||||
# Did all devices leave the house?
|
||||
elif category == STATE_CATEGORY_ALL_DEVICES and new_state.state == STATE_DEVICE_NOT_HOME and lights_are_on:
|
||||
self.logger.info("Everyone has left. Turning lights off")
|
||||
self.logger.info("Everyone has left but lights are on. Turning lights off")
|
||||
self.turn_light_off()
|
||||
|
|
|
@ -47,13 +47,13 @@ def track_time_change(eventbus, action, year='*', month='*', day='*', hour='*',
|
|||
assert isinstance(event, Event), "event needs to be of Event type"
|
||||
|
||||
if (point_in_time is not None and event.data['now'] > point_in_time) or \
|
||||
point_in_time is None and \
|
||||
(point_in_time is None and \
|
||||
matcher(event.data['now'].year, year) and \
|
||||
matcher(event.data['now'].month, month) and \
|
||||
matcher(event.data['now'].day, day) and \
|
||||
matcher(event.data['now'].hour, hour) and \
|
||||
matcher(event.data['now'].minute, minute) and \
|
||||
matcher(event.data['now'].second, second):
|
||||
matcher(event.data['now'].second, second)):
|
||||
|
||||
# point_in_time are exact points in time so we always remove it after fire
|
||||
event.remove_listener = listen_once or point_in_time is not None
|
||||
|
|
|
@ -34,8 +34,8 @@ class WeatherWatcher(object):
|
|||
return ephem.localtime(self.observer.next_setting(self.sun))
|
||||
|
||||
def update_sun_state(self, now=None):
|
||||
next_rising = ephem.localtime(self.observer.next_rising(self.sun))
|
||||
next_setting = ephem.localtime(self.observer.next_setting(self.sun))
|
||||
next_rising = self.next_sun_rising()
|
||||
next_setting = self.next_sun_setting()
|
||||
|
||||
if next_rising > next_setting:
|
||||
new_state = SUN_STATE_ABOVE_HORIZON
|
||||
|
|
Loading…
Add table
Reference in a new issue