Stop requiring the initial time in NightLightStateMachine
We're only fooling ourselves if we think that it's ready *right* after construction anyway. After all, the initial state of the lights won't be updated when the state machine is constructed.
This commit is contained in:
parent
db4434cd20
commit
9531dee52b
5 changed files with 31 additions and 19 deletions
|
|
@ -77,7 +77,14 @@ let mainAsync _ =
|
|||
let mqttClientOptions = MqttClientOptionsBuilder().WithTcpServer(server).Build()
|
||||
|
||||
let stateLock = new SemaphoreSlim(1, 1)
|
||||
let mutable state = NightLightStateMachine DateTime.Now
|
||||
|
||||
let! initialState =
|
||||
let emptyNightLightStateMachine = NightLightStateMachine()
|
||||
|
||||
TimeChanged DateTime.Now
|
||||
|> handleEvent mqttClient logger emptyNightLightStateMachine
|
||||
|
||||
let mutable state = initialState
|
||||
|
||||
mqttClient.add_ApplicationMessageReceivedAsync (fun e ->
|
||||
async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue