def test_lamp() : tz = tzlocal.get_localzone() place = Place(nkpCoord()) place.findSunTimes() scheme = murklanScheme(place) lamp = Lamp(1) lamp.update(datetime.time(12, 10, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be OFF. Press enter to continue.") lamp.update(datetime.time(5, 50, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be OFF. Press enter to continue.") lamp.update(datetime.time(6, 30, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be ON. Press enter to continue.") lamp.update(datetime.time(8, 30, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be ON. Press enter to continue.") lamp.update(datetime.time(9, 10, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be OFF. Press enter to continue.") lamp.update(datetime.time(18, 40, 5, 0, tz), scheme[1]) # after sunset but within offset test_wait("Lamp expected to be OFF. Press enter to continue.") lamp.update(datetime.time(18, 59, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be ON. Press enter to continue.") lamp.update(datetime.time(22, 29, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be ON. Press enter to continue.") lamp.update(datetime.time(22, 30, 5, 0, tz), scheme[1]) test_wait("Lamp expected to be OFF. Press enter to continue.")
import os import lamp import scheme import place nkp = place.Place(place.nkpCoord()) nkp.findSunTimes() myscheme = scheme.murklanScheme(nkp) lamp.update(myscheme)