summaryrefslogtreecommitdiff
path: root/tplink.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 /tplink.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 'tplink.go')
-rw-r--r--tplink.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/tplink.go b/tplink.go
index 11d8ab1..a256e71 100644
--- a/tplink.go
+++ b/tplink.go
@@ -16,7 +16,11 @@ const (
TPLink_HS100_OFF = false
)
-func TPLinkRun(config TPLinkConfigs, route Route) {
+func TPLinkRun(config TPLinkConfigs, tx chan MQTTMessage, route Route) {
+ for _, tplink := range config {
+ tx <- MQTTMessage{fmt.Sprintf("plug/%s", tplink.ID), []byte("exists"), true}
+ }
+
for message := range route.Destination {
ip, action, err := tplinkParseMessage(config, message)
if err != nil {