From ab6e123efc309bd9ee34dbb9c8e771a83e866e74 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Sat, 3 Jan 2026 19:30:43 +0100 Subject: [PATCH] ZigbeeCommand -> Message There isn't really anything specifically Zigbee about this type. --- NightLight.Core/Models.fs | 2 +- NightLight.Core/ZigbeeCommands.fs | 2 +- NightLight/Program.fs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NightLight.Core/Models.fs b/NightLight.Core/Models.fs index f4e6dc4..161902f 100644 --- a/NightLight.Core/Models.fs +++ b/NightLight.Core/Models.fs @@ -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 diff --git a/NightLight.Core/ZigbeeCommands.fs b/NightLight.Core/ZigbeeCommands.fs index f1572f1..946b7c4 100644 --- a/NightLight.Core/ZigbeeCommands.fs +++ b/NightLight.Core/ZigbeeCommands.fs @@ -22,4 +22,4 @@ let generateZigbeeCommand friendlyName targetColor targetBrightness = let topic = $"zigbee2mqtt/{friendlyName}/set" let payload = commandObj.ToJsonString() - ZigbeeCommand(topic, payload) + Message(topic, payload) diff --git a/NightLight/Program.fs b/NightLight/Program.fs index 6415415..a1a4326 100644 --- a/NightLight/Program.fs +++ b/NightLight/Program.fs @@ -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!