summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-12-20 12:27:47 +0100
committerxengineering <me@xengineering.eu>2025-12-20 12:27:47 +0100
commit5396eae035dfe02bc25d756972eeab81104c674c (patch)
tree6cab8dd3a10791bbcd69f5ea6991a3120dee5fd9 /main.go
parentd5062a0eec968982e86b9db5294ee6a006cae09a (diff)
downloadsia-server-5396eae035dfe02bc25d756972eeab81104c674c.tar
sia-server-5396eae035dfe02bc25d756972eeab81104c674c.tar.zst
sia-server-5396eae035dfe02bc25d756972eeab81104c674c.zip
Change topic structure
The new structure for the contact states is the following. <prefix>/contact/<id>/state The reasoning is: - `<prefix>` allows using multiple (Sia) services on the same broker - `contact` as device type indicates contact-specific semantics - `<id>` makes different contacts distinguishable - `state` is the actual payload
Diffstat (limited to 'main.go')
-rw-r--r--main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.go b/main.go
index eadcabb..075feb8 100644
--- a/main.go
+++ b/main.go
@@ -42,7 +42,7 @@ func main() {
log.Fatalf("Failed to get value: %v", err)
}
- topic := fmt.Sprintf("%s/%s", TOPIC_PREFIX, device.Address)
+ topic := fmt.Sprintf("%s/contact/%s/state", TOPIC_PREFIX, device.Address)
payload := []byte(fmt.Sprintf("%t", state))
client.Publish(topic, QOS, RETAINED, payload)
}