Hopefully fixed state being out of sync
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ae6e43da56
commit
cba9d0a596
6
main.go
6
main.go
|
@ -177,7 +177,6 @@ func main() {
|
||||||
if bridge == nil {
|
if bridge == nil {
|
||||||
panic("Bridge is nil")
|
panic("Bridge is nil")
|
||||||
}
|
}
|
||||||
livingRoom, _ := bridge.GetGroup(groupId)
|
|
||||||
|
|
||||||
opts := MQTT.NewClientOptions().AddBroker(fmt.Sprintf("%s:%s", host, port))
|
opts := MQTT.NewClientOptions().AddBroker(fmt.Sprintf("%s:%s", host, port))
|
||||||
opts.SetClientID("automation")
|
opts.SetClientID("automation")
|
||||||
|
@ -224,6 +223,7 @@ events:
|
||||||
fmt.Println("Coming home")
|
fmt.Println("Coming home")
|
||||||
if !isDay() {
|
if !isDay() {
|
||||||
fmt.Println("\tTurning on lights in the living room")
|
fmt.Println("\tTurning on lights in the living room")
|
||||||
|
livingRoom, _ := bridge.GetGroup(groupId)
|
||||||
livingRoom.Bri(0xff)
|
livingRoom.Bri(0xff)
|
||||||
livingRoom.Ct(Temperature)
|
livingRoom.Ct(Temperature)
|
||||||
}
|
}
|
||||||
|
@ -250,6 +250,9 @@ events:
|
||||||
fmt.Println("\tGradually turning on lights in the living room")
|
fmt.Println("\tGradually turning on lights in the living room")
|
||||||
// Start the ticker to gradually turn on the living room lights
|
// Start the ticker to gradually turn on the living room lights
|
||||||
ticker.Reset(1200 * time.Millisecond)
|
ticker.Reset(1200 * time.Millisecond)
|
||||||
|
|
||||||
|
livingRoom, _ := bridge.GetGroup(groupId)
|
||||||
|
|
||||||
fmt.Println("DEBUG STUFG")
|
fmt.Println("DEBUG STUFG")
|
||||||
fmt.Println(livingRoom.IsOn())
|
fmt.Println(livingRoom.IsOn())
|
||||||
fmt.Println(livingRoom.State.On)
|
fmt.Println(livingRoom.State.On)
|
||||||
|
@ -270,6 +273,7 @@ events:
|
||||||
|
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
brightness++
|
brightness++
|
||||||
|
livingRoom, _ := bridge.GetGroup(groupId)
|
||||||
if (!livingRoom.IsOn() || livingRoom.State.Bri < brightness) {
|
if (!livingRoom.IsOn() || livingRoom.State.Bri < brightness) {
|
||||||
fmt.Println("Setting brightness:", brightness)
|
fmt.Println("Setting brightness:", brightness)
|
||||||
livingRoom.Bri(brightness)
|
livingRoom.Bri(brightness)
|
||||||
|
|
Reference in New Issue
Block a user