Skip to content

Home Automation

Jurgen edited this page Dec 13, 2016 · 6 revisions

Pseudo Logic

time_of_day = home.datetime.timeofday; dark = time_of_day == DUSK | time_of_day == DAWN | time_of_day == NIGHT | time_of_day == SLEEPING

p = home.presence; family_past = p.past.Jurgen | p.past.Faith | p.past.Grandpa | p.past.Grandma; family_now = p.now.Jurgen | p.now.Faith | p.now.Grandpa | p.now.Grandma;p

momdad_now = p.now.Jurgen | p.now.Faith

IF (family_past == ABSENT) && (family_now == ABSENT) { // Do nothing for now

} else IF (family_past == PRESENT) && (family_now == ABSENT) { home.Lights.TurnAllOffIn(30_seconds); home.Switches.TurnAllOffIn(30_seconds); } else IF (past.Family == ABSENT) && (now.Family == PRESENT) { home.Lights.TurnOnIn(10_seconds, "Kitchen"); home.Lights.TurnOnIn(10_seconds, "Living Room"); home.Switches.TurnOnIn(10_seconds, "Christmas Tree"); } else IF (dark == true && momdad_now == PRESENT) { IF (home.Lights.IsOff("Kitchen") && home.Lights.IsOff("Living Room") && home.Lights.IsOff("Bed Room")) { home.Lights.TurnOnIn(10_seconds, "Bedroom"); } }

Clone this wiki locally