Script example 4: Presence simulation - Aanwezigheids simulatie

Freek-Jan BuijsmanFreek-Jan Buijsman xxter medewerker
December 2017 aangepast in Native scripts
This script is probably no longer needed since xxter has a built in and fully automated presence simulation. Still it can be useful as a reference. More information about the automated presence simulation can be found here.

This example consists of 4 scripts.
#Script 1 for starting the simulation
#This script turns two schedulers ON which start scripts 3 and 4 (in the morning and evening).
#But only if there has not been anyone at home for more than 6 hours...
WAIT 6 HOUR
SET SCHEDULER(21/Presence morning) TO 1
SET SCHEDULER(22/Presence evening) TO 1
#You could use a trigger on the 'all off' near the front door to start this script or a trigger on a contact of the burglar alarm, so the script is started when the alarm is turn on.
#Script 2 for stopping the simulation
#This script turns the schedulers off and stops the starting script.
SET SCHEDULER(21/Presence morning) TO 0
SET SCHEDULER(22/Presence evening) TO 0
STOP SCRIPT(1/Start presence simulation)
STOP SCRIPT(3/Morning simulation)
STOP SCRIPT(4/Evening simulation)
#You could use a presence detector to execute this script, or trigger it when the burglar alarm is turned off.
#Script 3 the simulation itself for the morning
WAIT 0 RANDOM 30 MIN
#First we wait for a random time, so every day the time the simulation start is a little different.
SET BYTE(25/Bedroom wall light) TO 50
SET BIT(23/Hallway) TO 1
WAIT 5 MIN
SET BYTE(11/Kitchen light) TO 80
WAIT 15 MIN RANDOM 10 MIN
SET BYTE(25/Bedroom wall light) TO 0
SET BYTE(14/Living room spots) TO 80
SET BIT(80/Curtains) TO 0
WAIT 20 MIN RANDOM 20 MIN
SET BIT(23/Hallway) TO 0
SET BYTE(11/Kitchen light) TO 0
SET BYTE(14/Living room spots) TO 0
#Script 4 the simulation for the evening
WAIT 0 RANDOM 1 HOUR
#First we wait for a random time, so every day the time the simulation start is a little different.
SET BYTE(11/Kitchen light) TO 70
SET BIT(23/Hallway) TO 1
SET BYTE(14/Living room spots) TO 80
WAIT 30 MIN RANDOM 30 MIN
SET BYTE(11/Kitchen light) TO 0
SET BYTE(14/Living room spots) TO 70
SET BYTE(24/Living room standing) TO 40
WAIT 1 HOUR RANDOM 1 HOUR
SET BIT(80/Curtains) TO 1
SET BYTE(25/Bedroom wall light) TO 70
SET BYTE(14/Living room spots) TO 50
WAIT 1 HOUR RANDOM 1 HOUR
SET BIT(23/Hallway) TO 0
SET BYTE(24/Living room standing) TO 0
SET BYTE(14/Living room spots) TO 0
WAIT 5 MIN
SET BYTE(25/Bedroom wall light) TO 0
Log In of Registreer om te reageren.