sunrise sunset working, not the cleanest solution but it works

This commit is contained in:
Sam Lewis
2022-10-24 23:03:04 -04:00
parent a2d3b46335
commit 66e179c568
4 changed files with 61 additions and 28 deletions

View File

@@ -25,6 +25,13 @@ func main() {
At("23:00").
Build()
_30minsBeforeSunrise := ga.
ScheduleBuilder().
Call(sunriseSched).
Daily().
Sunrise(app, "-30m").
Build()
zwaveEventListener := ga.
EventListenerBuilder().
EventTypes("zwave_js_value_notification").
@@ -33,6 +40,7 @@ func main() {
app.RegisterEntityListener(pantryDoor)
app.RegisterSchedule(_11pmSched)
app.RegisterSchedule(_30minsBeforeSunrise)
app.RegisterEventListener(zwaveEventListener)
app.Start()
@@ -72,3 +80,8 @@ func lightsOut(service *ga.Service, state *ga.State) {
service.Light.TurnOff("light.main_lights")
}
}
func sunriseSched(service *ga.Service, state *ga.State) {
service.Light.TurnOn("light.living_room_lamps")
service.Light.TurnOff("light.christmas_lights")
}