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-stepper device (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:

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:

Limits & safety

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: