Improve lamp names

This commit is contained in:
Sven van Heugten 2026-02-27 18:20:31 +01:00
parent 4a53489003
commit 1e313ca4ab
5 changed files with 35 additions and 35 deletions

View file

@ -41,11 +41,11 @@ type DeviceFriendlyName =
| DeviceFriendlyName deviceFriendlyName -> deviceFriendlyName
type Light =
| VardagsrumFonsterlampa
| VardagsrumVagglampa
| VardagsrumGolvlampa
| BadrumTaklampa
| SovrumNattduksbordlampa
| RightBedroomLamp
| LivingRoomWallLamp
| LivingRoomFloorLamp
| BathroomCeilingLamp
| LeftBedroomLamp
type LightProps =
{ FriendlyName: DeviceFriendlyName
@ -54,33 +54,33 @@ type LightProps =
let lightProps light =
match light with
| VardagsrumFonsterlampa ->
| RightBedroomLamp ->
{ FriendlyName = DeviceFriendlyName "Vardagsrum - Fönsterlampa"
Room = Bedroom
Bulb = IkeaBulb }
| VardagsrumVagglampa ->
| LivingRoomWallLamp ->
{ FriendlyName = DeviceFriendlyName "Vardagsrum - Vägglampa"
Room = LivingRoom
Bulb = PaulmannBulb }
| VardagsrumGolvlampa ->
| LivingRoomFloorLamp ->
{ FriendlyName = DeviceFriendlyName "Vardagsrum - Golvlampa"
Room = LivingRoom
Bulb = PaulmannBulb }
| BadrumTaklampa ->
| BathroomCeilingLamp ->
{ FriendlyName = DeviceFriendlyName "Badrum - Taklampa"
Room = Bathroom
Bulb = IkeaBulb }
| SovrumNattduksbordlampa ->
| LeftBedroomLamp ->
{ FriendlyName = DeviceFriendlyName "Sovrum - Nattduksbordlampa"
Room = Bedroom
Bulb = IkeaBulb }
let lights =
[ VardagsrumFonsterlampa
VardagsrumVagglampa
VardagsrumGolvlampa
BadrumTaklampa
SovrumNattduksbordlampa ]
[ RightBedroomLamp
LivingRoomWallLamp
LivingRoomFloorLamp
BathroomCeilingLamp
LeftBedroomLamp ]
let remoteControlFriendlyName = DeviceFriendlyName "Fjärrkontroll"

View file

@ -48,7 +48,7 @@ let internal createOrUpdateNightLightState
light,
{ Color = color
Brightness =
if alarm && (light = VardagsrumFonsterlampa || light = SovrumNattduksbordlampa) then
if alarm && (light = RightBedroomLamp || light = LeftBedroomLamp) then
brightness.Scale(getAlarmWeight time)
else
brightness
@ -105,18 +105,18 @@ type NightLightStateMachine private (maybeState: NightLightState option) =
| PressedOn ->
currentState
|> withAlarmOff
|> withStateFor VardagsrumFonsterlampa On
|> withStateFor SovrumNattduksbordlampa On
|> withStateFor RightBedroomLamp On
|> withStateFor LeftBedroomLamp On
| PressedOff ->
currentState
|> withAlarmOff
|> withStateFor VardagsrumFonsterlampa Off
|> withStateFor SovrumNattduksbordlampa Off
|> withStateFor RightBedroomLamp Off
|> withStateFor LeftBedroomLamp Off
| PressedLeft ->
currentState
|> withAlarmOff
|> withStateFor VardagsrumFonsterlampa Off
|> withStateFor SovrumNattduksbordlampa On
|> withStateFor RightBedroomLamp Off
|> withStateFor LeftBedroomLamp On
NightLightStateMachine(Some newNightLightState),
generateZigbeeCommandsForDifference (Some currentState) newNightLightState