ZigbeeCommand -> Message
There isn't really anything specifically Zigbee about this type.
This commit is contained in:
parent
12d0ecf0e6
commit
ab6e123efc
3 changed files with 4 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -22,4 +22,4 @@ let generateZigbeeCommand friendlyName targetColor targetBrightness =
|
|||
let topic = $"zigbee2mqtt/{friendlyName}/set"
|
||||
let payload = commandObj.ToJsonString()
|
||||
|
||||
ZigbeeCommand(topic, payload)
|
||||
Message(topic, payload)
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue