How to Schedule Mass-Downlinks (Multicast) using Datacake Rule Engine
This document provides a detailed guide on triggering mass downlinks (multicast/broadcast) on a time-based schedule using the Datacake Rule Engine, allowing you to send downlinks to multiple devices.
Last updated
Overview
This document provides a detailed guide on how to trigger mass downlinks (also known as multicast or broadcast downlinks) on a time-based schedule using the Datacake Rule Engine. This capability allows you to define a schedule for sending downlinks to multiple devices at once, addressing a common and critical use case for many customers.
Video Guide
Differences Between Single-Device Downlink and Multi-Device Downlink
It is very important that you read this section before we start showing you how setting up downlink schedulers or multicast downlink works.
On the Datacake rule engine, we have two different types of actions for downlinks: Single device downlink and multi-device downlink. Essentially, single device sends a single downlink and multi-device sends a downlink to a group of devices. You might assume that for sending a multicast downlink, you would choose the multi-device downlink. However, this is only the case if you are not working with time-based actions. We will explain the difference between the two, but it is important to read this section beforehand.
Single-Device Downlink
A single-device downlink is used when the product you create the rule on contains multiple devices. This setup is common for time-based schedules. For instance, if you set a rule to trigger every morning at 9 AM for a product with 100 devices, the rule will execute for all these devices simultaneously.
When configuring the action for a single-device downlink:
Select "Single Device Downlink": This is necessary because the rule will apply to each device in the product.
Choose "Triggering Device": The triggering device is the device or all the devices on which the rule is executed. Each device in the product triggers the downlink action individually according to the schedule.
This approach ensures that each device in the product receives the downlink at the specified time.
Multi-Device Downlink
Multi-device downlinks are used when the product you are creating the rule on does not contain the devices you want to send the downlink to. This scenario typically occurs with measurement-based triggers from an external sensor.
For example, you might have an outdoor temperature sensor and set a condition that if the temperature falls below 10 degrees, you want to switch off all heating devices. Since the triggering device is the single temperature sensor, you need to:
Select "Multi-Device Downlink": This allows you to send a downlink to multiple devices based on the condition met by a single triggering device.
Select the Target Product: Instead of specifying each device individually, you can select a product (group of devices) and define a single downlink action.
In both single-device and multi-device downlink cases, this setup ensures that you can control a large number of devices (hundreds or even thousands) with a single rule. This method is efficient and scalable, making it easy to manage extensive IoT deployments with minimal effort.
Scheduling Mass Downlinks on a Time-Based Schedule
Step 1: Create a New Rule
Log in to the Datacake platform and navigate to the workspace containing your devices.
Click on "Rules" in the left-hand menu.
Click on "Create New Rule".
Step 2: Select the Product
Choose the product that includes the devices you want to control. For instance, select the "McClymit Viki" product, which contains all 108 devices you want to manage.
Optional: Define device groups using tags if you only want the rule to apply to specific subsets of devices.
Step 3: Define the Time-Based Trigger
Select "Time-Based Schedule" as the trigger type.
Configure the Schedule:
Deselect "Saturday" and "Sunday" if you do not want the rule to run on weekends.
Set the time to 5:00 AM for the rule to execute each weekday morning.
Confirm the Trigger: Ensure the rule is set to activate at the specified time for all selected devices.
Step 4: Configure the Mass Downlink Action
Add a New Action and select "Single Device Downlink".
Configure the Downlink:
Select the downlink type relevant to your needs (e.g., "Set Temperature").
Define the parameters for the downlink (e.g., set the temperature to 22 degrees).
Set the Action Scope:
Since the rule is triggered based on a time schedule for all devices in the selected product, the downlink will be sent to all devices.
Name the Action: For example, "Weekday Morning Temperature Set".
Save the Rule: Click "Save" to finalize the rule.
Summary
By following these steps, you will have created a rule that automatically sends a downlink to all selected devices at 5 AM on weekdays, setting the temperature to 22 degrees.
Multi-Device Downlink based on external Measurements
Step 1: Create a New Rule
Log in to the Datacake platform and navigate to the workspace containing your devices.
Click on "Rules" in the left-hand menu.
Click on "Create New Rule".
Step 2: Select a Product
Choose the product that contains the external sensor. For example, select the "SenseCAP" product which has an outdoor temperature sensor.
Step 3: Define the Trigger
Select "New Measurement" as the trigger type.
Define the Condition:
Choose "Average of Last Hour" for the temperature measurement.
Set the condition to "greater than 15 degrees".
Step 4: Configure the Action
Add a New Action and select "Multi Device Downlink".
Configure the Downlink:
Select the target product (e.g., "McClymit Viki").
Define the downlink parameters (e.g., set temperature to 12 degrees).
Name the Action: For example, "External Temperature Shutdown".
Save the Rule.
Summary
This rule will monitor the external temperature sensor and, if the average temperature over the last hour exceeds 15 degrees, it will send a downlink to all devices in the selected product to set the temperature to 12 degrees.
Example Scenario: Morning Temperature Adjustment
Objective
Set all "Mclimate Vicki" devices to a specific temperature every weekday morning at 5 AM.
Steps
Create a Time-Based Rule:
Navigate to "Rules" and create a new rule.
Select the Product:
Choose "Mclimate Vicki Product" which includes all relevant devices.
Define the Time-Based Trigger:
Set the schedule to weekdays at 5 AM.
Configure the Downlink Action:
Select Single Device Downlink
Set the action to adjust the temperature to 22 degrees.
Name the action and save the rule.
Result
At 5 AM every weekday, all "McClymit Viki" devices will automatically receive a downlink to set their temperature to 22 degrees.
Conclusion
The Datacake Rule Engine's capability to schedule mass downlinks on a time-based schedule is a powerful feature for managing large groups of devices. By following the steps in this documentation, users can efficiently create rules that automate downlink scheduling, ensuring consistent and synchronized control over their IoT devices. This functionality is crucial for applications requiring regular and simultaneous updates across multiple devices.