Macros — program your devices
A macro is a small program you build once and run whenever you want — a sequence of device commands with waits, loops, and simple logic. The classic example: a DIY camera slider that glides A → B → A a few times with smooth acceleration, triggered from your phone. But macros drive any actuator — relays, PWM dimmers, Modbus registers, stepper motors.
Macros run on your gateway, not in the cloud. The platform compiles your macro into a compact program and pushes it to the gateway, which executes it locally. That's the only way fast, fine-grained motion (like micro-second stepper timing) can stay smooth. Only "call a webhook / publish to MQTT" steps run on our servers.
Requirements: a Synacl gateway running firmware 1.2.0+. Stepper moves need a
gpio-stepperdevice (STEP/DIR/EN pins) configured on that gateway.
Build a macro
Open Macros → New Macro and give it a name and a target gateway. Then build the routine two ways — switch freely between them:
- Blocks — add steps from a menu (Move stepper, Set output, PWM, Modbus write, Wait, Read sensor, Set variable, Call backend action, Log/Notify), reorder them, and tick "Repeat whole routine N times" to loop.
- Code — the same routine as JSON, for advanced logic like nested loops or
ifconditions.
Parameters
Declare parameters (e.g. DISTANCE, MAX_SPEED_US) with defaults and min/max. They become inputs
you can change each time you run — so one "slide" macro covers any distance or speed without editing.
Run it
Each macro card has a Run button. If the macro has parameters, you'll get a quick form to tweak them first. While it runs you'll see live status (started → running → done), and an Abort button stops it immediately. You can also drop a Macro Button widget on any dashboard for a big tap-to-run control that works great on a phone.
Trigger it automatically
Beyond the manual button, a macro can run:
- On a schedule — every N seconds, or once a day at a set time (great for a golden-hour timelapse).
- From a sensor rule — add a Run macro action to a Rule so a threshold launches it.
- On a device event — when a device or gateway goes online/offline.
Limits & safety
- Plan limits: your plan can cap how many macros you can create and how many steps each macro can contain. The Macros page shows your current usage and any caps right under the title (e.g. "2 / 5 macros · up to 50 steps each"). On most plans these default to unlimited — so if you don't see a number, there's no cap yet. You'll get a clear message if a save would exceed a limit.
- Macros are bounded by design: a maximum number of instructions, loop iterations, and total run time — a macro can't run away. There's no infinite loop; repeats are always a fixed count.
- Only one macro runs per gateway at a time.
- Actuators move real hardware — start with conservative speeds, and use the macro button's confirm-before-run option for anything that could damage equipment.
Worked example — camera slider
Start from the Camera slider template (the "Start from template…" menu). It repeats 3×:
move forward, wait, move back, wait — with DISTANCE, MAX_SPEED_US, MIN_SPEED_US, and
RAMP_STEPS as parameters. Point the move steps at your gpio-stepper device, set the parameters to
your rail, and tap Run.
More examples
Want something to copy and adapt? We have two cookbooks of ready-to-run recipes:
- Starter recipes — pulse a relay, blink an output, dimmer scenes, servo park & sweep, stepper jog & home, Modbus coil/register writes.
- Advanced recipes — fades and ramps with variables, a scheduled thermostat, staged cooling, pump hysteresis, step-and-shoot timelapse, dosing, and condition-triggered webhooks.