Implement the Right button on the bedroom remote
This commit is contained in:
parent
b9fc8bfaea
commit
d3a00b8a77
5 changed files with 74 additions and 64 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue