Macros / Timers
One of the most powerful features of the Centro-8 / 8M is the ability to execute macros, either at specific times, or in response to specific events. An event might be when a digital input is triggered, or when feedback is received from a device.
Configuring Macros
You can add as many macros as you wish to a Centro. After making changes to the macros in the PC software, you must then
perform an Upload to Processor
operation so that the Centro has the macro information.
To add a macro, select the Macros / Timers
option:
Each macro has the following:
Name - used internally to refer to the macro
Execution Type - this determines when the macro is run. The options are:
- Manually - this is typically run when a button is pressed on the Control app. You specify the macro from the list of commands in the action editor.
- Daily - this is run each day, either at a specific time, (eg 21:00:00 for 9pm), or at a certain time before/after sunrise/sunset, (eg 00:10:00 for 10 minutes before/after)
- Repeatedly - this is run constantly, from the time the project is uploaded to the Centro (eg 00:00:30 for every 30 seconds). Typically this is used to request feedback from a device,
or to show a UI indicator, possibly with a dependent flag, eg an icon flashing when the alarm is set.
- Specific Date/Time - this macro is run once, and once only, at the date/time specified. Useful for example to set a flag which shows a subpage requesting that the user
extends their system warranty etc.
- In the Future - this is similar to a Manual macro, but with a (possible long) delay before execution. For example, a macro called
Leaving Home
which turns off lights etc, but allows the user 15 minutes to exit the property. Such a macro is not appropriate for the Control App, as it may go out of wifi range, or go to standby mode. If the macro is triggered again whilst waiting to execute, then the timer is reset - the macro won't execute twice if already waiting to execute. - When an Input Activates / Deactivates - specific to the Centro-8, these macro types will fire when there is a change to the input state of one of the 8 digital inputs. For example,
you may have a doorbell push button connected to GND and input 1 of the Centro, and you want to play a sound when the button is pressed.
- When a variable changes - for global variables, you can specify a macro to run when the variable is set to a certain value, or in the case of number variables, within a certain range.
For example, the following would execute when the alarm system is set, during the day, if the temperature is over 20 degrees:
(assuming we had a global flag NightTime which is set ON when the sun sets, and OFF when the sun rises, and other variables linked to the alarm / heating system etc)
- Valid Months
For all macro execution types apart from manually
and x seconds in the future
- these are the months that the macro is permitted
to run. For example if you have a macro running a 9am each day, and you only want it to run in December, then untick all other months.
- Valid Days
For all macro execution types apart from manually
and x seconds in the future
- these are the days that the macro is permitted
to run. For example if you have a macro running a 9am each day, and you only want it to run at the weekend, then untick all days except
Saturday and Sunday.
- Dependent Flag
For all macro execution types apart from manually
and x seconds in the future
- when the macro is about to run, if a dependent flag
is selected, it will check the current state of the flag before deciding whether to execute the macro.
- Actions
A macro is simply a set of one or more actions. Double click the macro entry in the list to be presented with the exact same Action Editor that you see for a Control App button release event. The Centro can do any action that the Control app can, eg sending commands, altering (global) flags etc.
The only exceptions are:
- Jump to a Page - this would instruct all connected iOS/Android devices to jump to the specified page
- Enable/Disable Auto Lock - this would instruct all connected iOS/Android devices to enable/disable the auto lock feature
Adjust Brightness - this would instruct all connected iOS/Android devices to alter the brightness
Play a sound - this will cause the Centro to the play the sound from the audio output socket, rather than the Control App device playing the sound. Currently, only .wav files are supported.
Testing Macros
To test the functions of your macro, simply press the Test Macro
button. You have already performed an Upload to Processor
operation after adding, or making any changes to any macros,
before you are able to test them.