Mixer automation now listens to actual remote
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
8e0cc2140f
commit
eef5385f75
|
@ -37,7 +37,7 @@ func on[M any](client paho.Client, topic string, onMessage func(message M)) {
|
||||||
|
|
||||||
func RegisterAutomations(client paho.Client, prefix string, hue *hue.Hue, notify *ntfy.Notify, home *home.Home) {
|
func RegisterAutomations(client paho.Client, prefix string, hue *hue.Hue, notify *ntfy.Notify, home *home.Home) {
|
||||||
presenceAutomation(client, hue, notify, home)
|
presenceAutomation(client, hue, notify, home)
|
||||||
mixerAutomation(client, home)
|
mixerAutomation(client, prefix, home)
|
||||||
kettleAutomation(client, prefix, home)
|
kettleAutomation(client, prefix, home)
|
||||||
darknessAutomation(client, hue)
|
darknessAutomation(client, hue)
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,14 @@ import (
|
||||||
"automation/device"
|
"automation/device"
|
||||||
"automation/home"
|
"automation/home"
|
||||||
"automation/integration/zigbee"
|
"automation/integration/zigbee"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
paho "github.com/eclipse/paho.mqtt.golang"
|
paho "github.com/eclipse/paho.mqtt.golang"
|
||||||
)
|
)
|
||||||
|
|
||||||
func mixerAutomation(client paho.Client, home *home.Home) {
|
func mixerAutomation(client paho.Client, prefix string, home *home.Home) {
|
||||||
on(client, "test/remote", func(message zigbee.RemoteState) {
|
on(client, fmt.Sprintf("%s/living/remote"), func(message zigbee.RemoteState) {
|
||||||
mixer, err := device.GetDevice[device.OnOff](&home.Devices, "living_room/mixer")
|
mixer, err := device.GetDevice[device.OnOff](&home.Devices, "living_room/mixer")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
|
|
Reference in New Issue
Block a user