Store a lot less state

This commit is contained in:
Sven van Heugten 2026-03-15 11:18:17 +01:00
parent 3507385d6c
commit 3913522cc3
3 changed files with 49 additions and 70 deletions

View file

@ -36,12 +36,17 @@ let doesLightHavePowerAfterInteractions light interactions =
|> Seq.tryLast
|> Option.defaultValue false
let tryGetLastRemoteInteraction interactions =
let tryGetLastBedroomRemoteInteraction interactions =
interactions
|> Seq.indexed
|> Seq.choose (fun interaction ->
|> Seq.choose (fun (index, interaction) ->
match interaction with
| index, Interaction.RemoteInteraction remoteInteraction -> Some(index, remoteInteraction)
| Interaction.RemoteInteraction remoteInteraction ->
match remoteInteraction with
| RemotePressedOnButton
| RemotePressedOffButton
| RemotePressedLeftButton -> Some(index, remoteInteraction)
| RemotePressedRightButton -> None
| _ -> None)
|> Seq.tryLast