From 5728da8e6c631136336148bc42cd7da4f97e45e2 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Fri, 27 Feb 2026 18:23:49 +0100 Subject: [PATCH] Construct light list dynamically --- NightLight.Core/Models.fs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/NightLight.Core/Models.fs b/NightLight.Core/Models.fs index 20f9b24..e7bfdf9 100644 --- a/NightLight.Core/Models.fs +++ b/NightLight.Core/Models.fs @@ -1,6 +1,7 @@ module NightLight.Core.Models open System +open FSharp.Reflection type Message = { Topic: string; Payload: string } @@ -76,11 +77,9 @@ let lightProps light = Bulb = IkeaBulb } let lights = - [ RightBedroomLamp - LivingRoomWallLamp - LivingRoomFloorLamp - BathroomCeilingLamp - LeftBedroomLamp ] + FSharpType.GetUnionCases typeof + |> Array.map (fun case -> FSharpValue.MakeUnion(case, [||]) :?> Light) + |> Array.toList let remoteControlFriendlyName = DeviceFriendlyName "FjÀrrkontroll"