From ce6fd21cfc05af6b3c87a31fd845b7ee1d438726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bal=C3=A1zs=20Grill?= Date: Sun, 28 Apr 2024 17:09:50 +0200 Subject: [PATCH] sending get --- base.go | 2 ++ light.go | 1 + sensorvalues.go | 1 + 3 files changed, 4 insertions(+) diff --git a/base.go b/base.go index 745f2bd..782efc0 100644 --- a/base.go +++ b/base.go @@ -6,6 +6,8 @@ import ( "strings" ) +var getStatePayload = []byte("{\"state\":\"\"}") + type BaseSensor[SensorEvent any] struct { events chan SensorEvent } diff --git a/light.go b/light.go index 0eb015b..4c9b096 100644 --- a/light.go +++ b/light.go @@ -37,6 +37,7 @@ func NewLight(pubsub IPubSubRuntime, config *Light) ILight { result.color_temp.Process(data) } }) + pubsub.Send(config.StateTopic+"/get", getStatePayload) result.state = onOffStateField{ stateField: stateField[bool]{ diff --git a/sensorvalues.go b/sensorvalues.go index 52d5149..64909ed 100644 --- a/sensorvalues.go +++ b/sensorvalues.go @@ -51,5 +51,6 @@ func ParseSensorValue[T any](context IPubSubRuntime, Topic string, ValueTemplate break } }) + context.Send(Topic+"/get", getStatePayload) return result }