Scheduling Usage Guide
Scheduling in ESP RainMaker allows devices to perform actions at specific times, either absolute (e.g., at 6:30 p.m.) or relative (e.g., 3 hours from now). It supports one-time events, recurring actions on specific days, on specific dates, or annually, and can handle time zone and daylight saving time changes. The feature is implemented on the node side, with the cloud serving as a conduit for communication, and is easily accessed through an API and mobile apps.
- To learn more about scheduling, click here.
- For notes on Schedules Across Nodes in the phone apps, click here.
Scheduling works in conjunction with the time service. You must set up and configure it; otherwise, schedules will not trigger.
Usage Guide
Enable Scheduling
The ESP RainMaker exposes a single API to enable scheduling:
esp_err_t esp_rmaker_schedule_enable(void);
This API should be called after esp_rmaker_node_init()
, but before esp_rmaker_start()
.
- The maximum number of schedules supported can be configured by
CONFIG_ESP_RMAKER_SCHEDULING_MAX_SCHEDULES
. - You can find this in
idf.py menuconfig
according to the steps below:
You may also need to increase CONFIG_ESP_RMAKER_MAX_PARAM_DATA_SIZE
to support a larger number of schedules, as the schedule payload size will increase.
Before using the scheduling feature, as mentioned earlier, it is recommended to set the time zone first. Please check here for information regarding time zones. The simplest way is to set the CONFIG_ESP_RMAKER_DEF_TIMEZONE
option, such as CONFIG_ESP_RMAKER_DEF_TIMEZONE="Asia/Shanghai"
.
You can find this in idf.py menuconfig
according to the steps below:
Daylight Schedules Configuration (Available from v1.7.1)
Daylight schedules enable scheduling based on sunrise and sunset times using astronomical calculations. This feature requires additional configuration.
Enable Daylight Schedules
To enable daylight scheduling support, you need to configure two options:
-
Enable ESP Schedule Daylight Support:
- Set
CONFIG_ESP_SCHEDULE_ENABLE_DAYLIGHT=y
- Path:
idf.py menuconfig
→Component config
→ESP Schedule
→Enable Daylight Support
- Set
-
Enable ESP RainMaker Daylight Support:
- Set
CONFIG_ESP_RMAKER_SCHEDULE_ENABLE_DAYLIGHT=y
- Path:
idf.py menuconfig
→ESP RainMaker Config
→ESP RainMaker Scheduling
→Enable Daylight Schedules
- Set
Configuration Impact
- Flash Usage: Enabling daylight schedules requires approximately 15KB of additional firmware size.
- Dependencies: Requires proper time service configuration for accurate calculations.
- Location Data: Schedules require latitude and longitude coordinates for astronomical calculations.
Service Attribute
When daylight schedules are enabled, the schedule service will include a daylight_support
attribute set to "yes"
, allowing client applications to discover this capability automatically.
Daylight schedules require geographical coordinates (latitude and longitude) to calculate sunrise and sunset times. These coordinates must be provided in each daylight schedule trigger.