ZigbeeCommand -> Message

There isn't really anything specifically Zigbee about this type.
This commit is contained in:
Sven van Heugten 2026-01-03 19:30:43 +01:00
parent 12d0ecf0e6
commit ab6e123efc
3 changed files with 4 additions and 4 deletions

View file

@ -8,7 +8,7 @@ type Event =
| ReceivedZigbeeEvent of payload: string
| TimeChanged of DateTime
type ZigbeeCommand = ZigbeeCommand of Topic: string * Payload: string
type Message = Message of Topic: string * Payload: string
type ParseZigbeeEventError =
| InvalidJson

View file

@ -22,4 +22,4 @@ let generateZigbeeCommand friendlyName targetColor targetBrightness =
let topic = $"zigbee2mqtt/{friendlyName}/set"
let payload = commandObj.ToJsonString()
ZigbeeCommand(topic, payload)
Message(topic, payload)

View file

@ -10,7 +10,7 @@ open NightLight.Core
let private generateMqttMessage zigbeeCommand =
match zigbeeCommand with
| ZigbeeCommand(topic, payload) ->
| Message(topic, payload) ->
MqttApplicationMessageBuilder()
.WithTopic(topic)
.WithPayload(payload)
@ -22,7 +22,7 @@ let private publishZigbeeCommands (mqttClient: IMqttClient) (logger: ILogger) (c
commands
|> Seq.iter (fun command ->
match command with
| ZigbeeCommand(topic, payload) ->
| Message(topic, payload) ->
logger.LogInformation("Publishing message {Payload} to topic {Topic}...", payload, topic))
return!