def test_turn_on_off(put_nothing): api = HueApi() api.lights = [ HueLight(1, 'Light 1', {}, None), HueLight(2, 'light 2', {}, None) ] for light in api.lights: assert not light.state.is_on api.turn_on() for light in api.lights: assert light.state.is_on api.turn_off([1]) assert not api.lights[0].state.is_on assert api.lights[1].state.is_on
lateEveBool = 1 #set lateEve brightness changeBrightness(50, 2, 0) if currentHour >= (ss.hour + 1) and currentHour <= 20: #ss - 8pm if eveBool == 0: zeroBools() eveBool = 1 #set Eve brightness changeBrightness(200, 2, 0) if currentHour > sr.hour and currentHour < ss.hour and daytimeBool == 0: #daytime - between sunrise and sunset zeroBools() daytimeBool = 1 changeBrightness(1, 2, 0) api.turn_off() if daytimeBool == 1 or eveBool == 1 or lateEveBool == 1: if lastPhased == 0: #first run lastPhased = time phase(-1) phase(phaseMinutes) #phase(phaseMinutes) #sending the second command may override the first and cause the phase to take 20m intead of 1 elif ((time - lastPhased).seconds / 60) >= phaseMinutes: lastPhased = time phase(phaseMinutes) print("Sleeping.") sleep(2) ##Sunrise (defined Colors)