Skip to main content

Schedules and automations

Both features are built in. There is no enable call, no service to create, and no Kconfig option to switch them on — esp_rmaker_node_init() starts them and esp_rmaker_start() fetches their details from the cloud.

What you have to get right is everything around them: the node needs synchronised time, and your write callback needs to handle being invoked by a schedule.

No enable call, and no per-entry operations

Schedules and automation triggers come up automatically — there is nothing to enable. There are also no add/remove/edit/enable/disable operations on the wire: the cloud uploads the complete schedule set and the node replaces what it holds. Scenes are not implemented on the node.

Schedules

A schedule is a set of parameter values plus a trigger — "set the light to 20% at 22:00 on weekdays". Evaluation happens on the node, using its local clock, so schedules keep firing while the internet is down.

What firmware must do

Two things:

1. Enable time sync. A node with no clock cannot fire a schedule. Set enable_time_sync in the SDK config, and enable the timezone service so the user's local time is meaningful:

esp_rmaker_config_t cfg = { .enable_time_sync = true };
esp_rmaker_node_t *node = esp_rmaker_node_init(&cfg, "Light", "light");
/* … */
esp_rmaker_timezone_service_enable();

See Time and timezone. Schedules are armed only after the first successful time sync; before that they are deferred.

2. Handle the SCHEDULE request source. When a schedule fires, the SDK calls your ordinary write callback with ctx->src == ESP_RMAKER_REQ_SRC_SCHEDULE. In most products that needs no special handling — the point of a schedule is to behave like any other write. But if your device does something user-visible on change, like sound a chime, you probably want to suppress it:

if (ctx && ctx->src == ESP_RMAKER_REQ_SRC_SCHEDULE) {
app_driver_set_quiet_mode(true);
}

That is all. Storage, timer arming, DST handling, re-arming after reboot, and reporting the schedule set back to the cloud are the SDK's job.

Persistence and reboots

Schedules are persisted to NVS as a versioned blob. On boot the SDK reloads them and re-arms every schedule, so a power cut does not lose them and does not need a cloud round trip to recover.

Capacity

OptionDefaultRange
CONFIG_RMAKER_SCHEDULING_MAX_SCHEDULES101–50

Raising the limit grows the reported-parameters JSON, which grows every state report that includes it. Raise it only if your product genuinely needs more, and check the resulting payload size against your MQTT buffer.

Automation triggers

An automation trigger watches a parameter for a threshold condition — "when temperature goes above 30, notify". Triggers are attached to a specific parameter and evaluated on the node, inside esp_rmaker_param_update().

What firmware must do

Nothing, beyond reporting the parameter in the first place. The flow is entirely internal:

Two consequences worth knowing:

  • Triggers only fire on esp_rmaker_param_update(). A value your driver knows about but has not reported does not exist as far as triggers are concerned. If a sensor can change without your code noticing, poll it.
  • Trigger evaluation runs on the calling task. Keep it in mind if you update parameters from a tight loop or an interrupt-adjacent context.

Triggers are pushed down from the cloud with the node's details; a trigger arriving with enabled: false is not added to the node at all.

On-node triggers vs cloud automations

These are two different things with confusingly similar names:

On-node automation triggersCloud automations
EvaluatedOn the node, in esp_rmaker_param_update()In the cloud
Works offlineYesNo
Can act on other nodesNoYes
Firmware workNoneNone

See Product overview → Automations for the cloud side.

Debugging

SymptomLikely cause
Schedules never fireNo time sync. Check local-time on the serial console — if it is wrong or unavailable, fix time sync first.
Schedules fire at the wrong hourTimezone not set, or set only as a location string with no POSIX rules. See Time and timezone.
Schedules fire, but nothing happensYour write callback is not handling the parameter type, or is rejecting the value. Reproduce with set-param on the console.
Some schedules are silently droppedCONFIG_RMAKER_SCHEDULING_MAX_SCHEDULES reached.
Triggers never notifyThe parameter is not being updated through esp_rmaker_param_update().