Remove the remoteControlledLights helper value

This commit is contained in:
Sven van Heugten 2026-01-17 16:36:46 +01:00
parent 0bf13d4c6f
commit 9104fac638
3 changed files with 9 additions and 9 deletions

View file

@ -37,7 +37,8 @@ let internal withStateFor (light: Light) (state: State) (oldNightLightState: Nig
LightToState = Map.add light { oldState with State = state } oldNightLightState.LightToState }
let internal withStateForRemoteControlledLights (state: State) (oldNightLightState: NightLightState) =
remoteControlledLights
lights
|> Seq.filter (not << _.ControlledWithRemote.IsNonRemote)
|> Seq.fold (fun acc light -> acc |> withStateFor light state) oldNightLightState
let internal withAlarmOff (oldNightLightState: NightLightState) =
@ -79,8 +80,7 @@ type NightLightStateMachine private (maybeState: NightLightState option) =
| PressedOff -> currentState |> withStateForRemoteControlledLights Off
| PressedLeft ->
let lightThatShouldBeOn =
remoteControlledLights
|> Seq.find (fun light -> light.ControlledWithRemote = RemoteLeft)
lights |> Seq.find (fun light -> light.ControlledWithRemote = RemoteLeft)
currentState
|> withStateForRemoteControlledLights Off