Track motion sensor activity over a period of time – ETC Unison Mosaic Designer v1.11.0 User Manual
Page 221

Trigger Programming Guide
start and release timeline actions in the trigger window if they want to change which timeline is run - they do not
need to modify the script.
Track motion sensor activity over a period of time
A foyer has 8 pressure pads under the carpet connected to the contact closure inputs of the Controller. We need
to count how many times the pressure pads are activated in any 15 second period as a simple measure of activity
in the foyer. One of 4 timelines should be selected based on the level of activity.
Hopefully by now you have a pretty good idea of how you could keep a count of the number of digital inputs using
script. The new element here is a need for a 15 second timer. We don't do this using script alone but make use of
the timeline facilities the Controller already offers.
First the easy bit - for each digital input there is a trigger and they all run the same very simple script:
count = count + 1
Create a timeline that has no lighting programming but has a flag at 15 seconds. We set the timeline to loop and
add a startup trigger that runs it. A trigger on that flag will now fire every 15 seconds while the Controller is running
and we set it to run the following script:
-- make sure that count has a value (not first time)
if count then
-- decide which of the 4 timelines to run
if count < 5 then
start_timeline(1)
elseif count < 10 then
start_timeline(2)
elseif count < 15 then
start_timeline(3)
else
start_timeline(4)
end
end
-- now reset count
count = 0
Ideally we should also run this script on startup to initialise count - otherwise any digital inputs during the first 15
seconds will try to use count before it has a value and the script will fail (this will not harm anything or cause the
Controller to fail - it will just leave rude messages in the activity log).
Initially we have got the timer timeline running continuously. What if we only wanted to count for 15 seconds from
the first digital input and then stop and wait?
First we would modify the timer timeline (say it is number 5) so that it no longer loops. Then we would modify our
script on the digital inputs to be:
if count == 0 then
start_timeline(5)
end
count = count + 1
- 221 -