Remove Time on FakeHome
We'll have a lot more stuff that we need to compute from the actual interactions, so let's just get the boilerplate ready.
This commit is contained in:
parent
c8e1f0c9fe
commit
db4434cd20
2 changed files with 23 additions and 15 deletions
|
|
@ -44,8 +44,6 @@ type FakeLight(light: Light) =
|
|||
color <- newColor
|
||||
|
||||
type FakeHome(now: DateTime) =
|
||||
let mutable time = now
|
||||
|
||||
let mutable nightLightStateMachine = NightLightStateMachine now
|
||||
|
||||
let assertIsOkAndGet result =
|
||||
|
|
@ -95,8 +93,6 @@ type FakeHome(now: DateTime) =
|
|||
commands |> Seq.iter processCommand
|
||||
nightLightStateMachine <- newState
|
||||
|
||||
member _.Time = time
|
||||
|
||||
member _.LightStates = friendlyNameToFakeLight.Values |> Seq.map _.LightWithState
|
||||
|
||||
member _.Interact(interaction: Interaction) =
|
||||
|
|
@ -113,9 +109,7 @@ type FakeHome(now: DateTime) =
|
|||
|> ReceivedZigbeeEvent
|
||||
|> sendEvent
|
||||
| HumanInteraction(LightTurnedOff light) -> friendlyNameToFakeLight[light.FriendlyName].TurnOff()
|
||||
| TimeChanged newTime ->
|
||||
time <- newTime
|
||||
newTime |> Event.TimeChanged |> sendEvent
|
||||
| TimeChanged newTime -> newTime |> Event.TimeChanged |> sendEvent
|
||||
|
||||
type FakeHome with
|
||||
member this.Interact(interactions: Interaction seq) = interactions |> Seq.iter this.Interact
|
||||
|
|
@ -127,9 +121,3 @@ type FakeHome with
|
|||
| On(brightness, color) -> Some(light, brightness, color)
|
||||
| Off -> None)
|
||||
|> Seq.forall condition
|
||||
|
||||
member this.IsDay() =
|
||||
this.Time.TimeOfDay >= TimeSpan.FromHours 5.5
|
||||
&& this.Time.TimeOfDay < TimeSpan.FromHours 20.5
|
||||
|
||||
member this.IsNight() = not (this.IsDay())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue