summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-12-20 13:09:40 +0100
committerxengineering <me@xengineering.eu>2025-12-20 13:09:40 +0100
commitdf3d898644f5b7164ea2ba1baf84ed82c20d31c4 (patch)
treefa00ade5f7189c3d6e3bb16d772a04ef2a8789f3
parent7bc3ce328d61c1afe138802ded812d718b056257 (diff)
downloadsia-server-df3d898644f5b7164ea2ba1baf84ed82c20d31c4.tar
sia-server-df3d898644f5b7164ea2ba1baf84ed82c20d31c4.tar.zst
sia-server-df3d898644f5b7164ea2ba1baf84ed82c20d31c4.zip
Publish state in retained mode
This ensures the MQTT broker caches the state when it is sent by Sia and sends it via MQTT to new MQTT clients. Thus no state polling is required by the MQTT client.
-rw-r--r--main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.go b/main.go
index 6f1695d..d4ef33b 100644
--- a/main.go
+++ b/main.go
@@ -18,7 +18,7 @@ const (
CLIENT_ID = `sia-server`
TOPIC_PREFIX = `sia`
QOS = byte(0)
- RETAINED = false
+ RETAINED = true
MQTT_CONNECT_TIMEOUT = time.Second * 5
MQTT_DISCONNECT_TIMEOUT_US = 500
POLLING_PERIOD = 50 * time.Millisecond