Strongly type the device FriendlyName
This commit is contained in:
parent
8cc59c4738
commit
89a8c599c7
4 changed files with 23 additions and 12 deletions
|
|
@ -4,7 +4,7 @@ open System.Text.Json.Nodes
|
|||
open NightLight.Core.Models
|
||||
open NightLight.Core.Moods
|
||||
|
||||
let generateZigbeeCommand friendlyName targetColor targetBrightness =
|
||||
let generateZigbeeCommand (friendlyName: DeviceFriendlyName) targetColor targetBrightness =
|
||||
let commandObj = JsonObject()
|
||||
|
||||
match targetColor with
|
||||
|
|
@ -19,7 +19,7 @@ let generateZigbeeCommand friendlyName targetColor targetBrightness =
|
|||
match targetBrightness with
|
||||
| Brightness b -> b
|
||||
|
||||
let topic = $"zigbee2mqtt/{friendlyName}/set"
|
||||
let topic = $"zigbee2mqtt/{friendlyName.Get}/set"
|
||||
let payload = commandObj.ToJsonString()
|
||||
|
||||
{ Topic = topic; Payload = payload }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue