am wondering if it will do what I am after.
I am thinking about a statemachine for home automation with some logic similar to this:
var stateMachine = new StateMachine<State, Trigger>(State.UnOccupied);
stateMachine.Configure(State.UnOccupied)
.Permit(Trigger.SensorActivity, State.Occupied)
.Ignore(Trigger.AlarmFullSet);
stateMachine.Configure(State.Occupied)
.Permit(Trigger.AlarmFullSet, State.UnOccupied)
.Permit(Trigger.AlarmPartSet, State.Asleep)
.PermitReentry(Trigger.SensorActivity);
stateMachine.Configure(State.Asleep)
.SubstateOf(State.Occupied)
.Permit(Trigger.AlarmUnset, State.Occupied);
However I want to represent the state of rooms within a house and also the overall state of the house..
IE
Home
House Object
Upstairs
Bedroom 1
Bedroom 2
Downstairs
Kitchen
Living Room
Garden
Front
Back
Side
So if Living room is occupied then so is the downstairs and the house and the home..
Apologies in advance my C# isn't the best and I am throwing myself in at the deep end!
Also is it possible to do timed leaving of states.. so a sensor could trigger a room to be occupied, then more activity triggers ‘reentrant?’ (Restarts a counter / timer / adjusts a schedule) on an occupied state entry – then after 15mins of no more entry/activity events, occupancy clears on that area and the state transitions to unoccupied for that area.