House Modes and Event Groups for Holiday or Vacation Management
There are several “Modes” that your house may be in. Vacation mode, Holiday mode, Away mode and so forth. It can be useful to have groups of events that are enabled or disabled based on the state of these various modes. XTension doesn’t give you a short list of Modes to choose from, but rather gives you the scripting tools necessary to implement as many as you wish.
XTension has no high level idea of a “mode” but you can create groups of named events and pseudo “MODE” units which are far more flexible.
Create your special mode events with names that begin with their Mode name in parans like “(AWAY) outdoor lights on” or “(HOLIDAY) front string lights on” You can use the normal Events system to create and maintain them and add as many more as you like anytime without having to touch any more code.
To enable and disable the events create a Mode control pseudo unit and put the following scripts in it’s On and Off script:
ON Script code
property EventPrefix:“(HOLIDAY)” set eventList to all events repeat with thisEvent in eventList if thisEvent begins with EventPrefix then unsuspend event thisEvent end if end repeat
and then this in the OFF script code:
property EventPrefix:“(HOLIDAY)” set eventList to all events repeat with thisEvent in eventList if thisEvent begins with EventPrefix then suspend event thisEvent end if end repeat
You can now create new or edit the Holiday events with the normal Edit Event window and control them all with that pseudo unit. Add it to a web remote list, or even create another scheduled event that turns it on and off at specific dates or times. You can create as many event groups as you wish this way.
This has the additional value of giving you a pseudo you can check in other places in the code as well. If you have an (AWAY) pseudo then you can check for that in any other script and take different actions based on that. Perhaps you don’t care if there is motion in the front hall while you’re home but you would definitely want to get an alert to your phone if it happened while you were away. You can check the state of that pseudo in any other place and take the appropriate action.
You might want your MODE Away pseudo to be turned on when all your families phones leave the house and if so then it could also set back your thermostat and automatically enable those other events. You can add as many other actions or logic to the end of the units ON and OFF script that you wish.