Skip to content

Commit

Permalink
sending get
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsgrill committed Apr 28, 2024
1 parent a49df1f commit ce6fd21
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"strings"
)

var getStatePayload = []byte("{\"state\":\"\"}")

type BaseSensor[SensorEvent any] struct {
events chan SensorEvent
}
Expand Down
1 change: 1 addition & 0 deletions light.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]{
Expand Down
1 change: 1 addition & 0 deletions sensorvalues.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,6 @@ func ParseSensorValue[T any](context IPubSubRuntime, Topic string, ValueTemplate
break
}
})
context.Send(Topic+"/get", getStatePayload)
return result
}

0 comments on commit ce6fd21

Please sign in to comment.