diff options
| author | xengineering <me@xengineering.eu> | 2025-12-20 12:27:47 +0100 |
|---|---|---|
| committer | xengineering <me@xengineering.eu> | 2025-12-20 12:27:47 +0100 |
| commit | 5396eae035dfe02bc25d756972eeab81104c674c (patch) | |
| tree | 6cab8dd3a10791bbcd69f5ea6991a3120dee5fd9 /main.go | |
| parent | d5062a0eec968982e86b9db5294ee6a006cae09a (diff) | |
| download | sia-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.go | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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) } |
