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
|
| ReceivedZigbeeEvent of payload: string
|
||||||
| TimeChanged of DateTime
|
| TimeChanged of DateTime
|
||||||
|
|
||||||
type ZigbeeCommand = ZigbeeCommand of Topic: string * Payload: string
|
type Message = Message of Topic: string * Payload: string
|
||||||
|
|
||||||
type ParseZigbeeEventError =
|
type ParseZigbeeEventError =
|
||||||
| InvalidJson
|
| InvalidJson
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,4 @@ let generateZigbeeCommand friendlyName targetColor targetBrightness =
|
||||||
let topic = $"zigbee2mqtt/{friendlyName}/set"
|
let topic = $"zigbee2mqtt/{friendlyName}/set"
|
||||||
let payload = commandObj.ToJsonString()
|
let payload = commandObj.ToJsonString()
|
||||||
|
|
||||||
ZigbeeCommand(topic, payload)
|
Message(topic, payload)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ open NightLight.Core
|
||||||
|
|
||||||
let private generateMqttMessage zigbeeCommand =
|
let private generateMqttMessage zigbeeCommand =
|
||||||
match zigbeeCommand with
|
match zigbeeCommand with
|
||||||
| ZigbeeCommand(topic, payload) ->
|
| Message(topic, payload) ->
|
||||||
MqttApplicationMessageBuilder()
|
MqttApplicationMessageBuilder()
|
||||||
.WithTopic(topic)
|
.WithTopic(topic)
|
||||||
.WithPayload(payload)
|
.WithPayload(payload)
|
||||||
|
|
@ -22,7 +22,7 @@ let private publishZigbeeCommands (mqttClient: IMqttClient) (logger: ILogger) (c
|
||||||
commands
|
commands
|
||||||
|> Seq.iter (fun command ->
|
|> Seq.iter (fun command ->
|
||||||
match command with
|
match command with
|
||||||
| ZigbeeCommand(topic, payload) ->
|
| Message(topic, payload) ->
|
||||||
logger.LogInformation("Publishing message {Payload} to topic {Topic}...", payload, topic))
|
logger.LogInformation("Publishing message {Payload} to topic {Topic}...", payload, topic))
|
||||||
|
|
||||||
return!
|
return!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue