Mixer automation now listens to actual remote
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dreaded_X 2022-11-26 18:39:20 +01:00
parent 8e0cc2140f
commit eef5385f75
Signed by: Dreaded_X
GPG Key ID: 76BDEC4E165D8AD9
2 changed files with 4 additions and 3 deletions

View File

@ -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) {
presenceAutomation(client, hue, notify, home)
mixerAutomation(client, home)
mixerAutomation(client, prefix, home)
kettleAutomation(client, prefix, home)
darknessAutomation(client, hue)
}

View File

@ -4,13 +4,14 @@ import (
"automation/device"
"automation/home"
"automation/integration/zigbee"
"fmt"
"log"
paho "github.com/eclipse/paho.mqtt.golang"
)
func mixerAutomation(client paho.Client, home *home.Home) {
on(client, "test/remote", func(message zigbee.RemoteState) {
func mixerAutomation(client paho.Client, prefix string, home *home.Home) {
on(client, fmt.Sprintf("%s/living/remote"), func(message zigbee.RemoteState) {
mixer, err := device.GetDevice[device.OnOff](&home.Devices, "living_room/mixer")
if err != nil {
log.Println(err)