Implement the Right button on the bedroom remote

This commit is contained in:
Sven van Heugten 2026-02-27 19:09:13 +01:00
parent b9fc8bfaea
commit d3a00b8a77
5 changed files with 74 additions and 64 deletions

View file

@ -52,7 +52,11 @@ let internal createOrUpdateNightLightState
brightness.Scale(getAlarmWeight time)
else
brightness
State = if alarm then On else previousState })
State =
if alarm && (light = RightBedroomLamp || light = LeftBedroomLamp) then
On
else
previousState })
|> Map.ofSeq
{ Time = time
@ -117,6 +121,11 @@ type NightLightStateMachine private (maybeState: NightLightState option) =
|> withAlarmOff
|> withStateFor RightBedroomLamp Off
|> withStateFor LeftBedroomLamp On
| PressedRight ->
currentState
|> withAlarmOff
|> withStateFor LivingRoomWallLamp Off
|> withStateFor LivingRoomFloorLamp Off
NightLightStateMachine(Some newNightLightState),
generateZigbeeCommandsForDifference (Some currentState) newNightLightState