summaryrefslogtreecommitdiff
path: root/shelly.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2026-03-26 21:02:20 +0100
committerxengineering <me@xengineering.eu>2026-03-26 21:34:16 +0100
commit0ec5e0034891075ca0c70c6d29e20442c8ddb46e (patch)
treeffe261f4141c823bb6d345e6e22e12ec630b8ae5 /shelly.go
parent443ba52ab3f49a28e8874ebcb5476e36c3defb4c (diff)
downloadsia-server-0ec5e0034891075ca0c70c6d29e20442c8ddb46e.tar
sia-server-0ec5e0034891075ca0c70c6d29e20442c8ddb46e.tar.zst
sia-server-0ec5e0034891075ca0c70c6d29e20442c8ddb46e.zip
Add Shelly / TP-Link device discovery
This announces Shelly and TP-Link devices with an empty MQTT message. This makes it possible that a client can display the available devices.
Diffstat (limited to 'shelly.go')
-rw-r--r--shelly.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/shelly.go b/shelly.go
index 508b393..2fa2fa6 100644
--- a/shelly.go
+++ b/shelly.go
@@ -9,7 +9,11 @@ import (
"github.com/gorilla/websocket"
)
-func ShellyRun(config ShellyConfigs, route Route) {
+func ShellyRun(config ShellyConfigs, tx chan MQTTMessage, route Route) {
+ for _, shelly := range config {
+ tx <- MQTTMessage{fmt.Sprintf("cover/%s", shelly.ID), []byte("exists"), true}
+ }
+
for message := range route.Destination {
ip, command, err := parseMessage(config, message)
if err != nil {