Last Updated on : 2024-05-14 08:00:15download
The sub-device group feature allows users to create groups and add the sub-devices of the same type to the same group.
This way, a command sent to a group will apply to all sub-devices in this group. Group commands can reduce workload and avoid the potential complication that might arise from concurrent data exchanges.
For example, previously, users must send 50 commands to 50 devices of the same type. Now, after these 50 devices are added to one group, one command sent once can make the control of 50 devices happen.
The module instructs the MCU to add a sub-device to a group.
The module sends the following data.
55 AA 00 0E 00 1F 7B 22 67 69 64 22 3A 22 31 30 30 32 30 22 2C 22 63 69 64 73 22 3A 5B 22 31 32 33 34 22 5D 7D 20
Payload data
{"gid":"10020","cids":["1234"]}
The module instructs the MCU to add the sub-device of 1234
to the group of 10020
.
The MCU returns the following data.
55 AA 00 0E 00 2A 7B 22 72 65 74 73 22 3A 5B 30 5D 2C 22 67 69 64 22 3A 22 31 30 30 32 30 22 2C 22 63 69 64 73 22 3A 5B 22 31 32 33 34 22 5D 7D 7B
Payload data
{"rets":[0],"gid":"10020","cids":["1234"]}
rets
indicates the operation result. 0
means success. The payload example indicates the MCU has added the sub-device of 1234
to the group 10020
. You can configure the values that the MCU returns in case of a failed operation.
The module instructs the MCU to remove a sub-device from a group.
The module sends the following data.
55 AA 00 0F 00 1F 7B 22 67 69 64 22 3A 22 31 30 30 32 30 22 2C 22 63 69 64 73 22 3A 5B 22 31 32 33 34 22 5D 7D 21
Payload data
{"gid":"10020","cids":["1234"]}
The module instructs the MCU to remove the sub-device of 1234
from the group of 10020
.
The MCU returns the following data.
55 AA 00 0F 00 2A 7B 22 72 65 74 73 22 3A 5B 30 5D 2C 22 67 69 64 22 3A 22 31 30 30 32 30 22 2C 22 63 69 64 73 22 3A 5B 22 31 32 33 34 22 5D 7D 7C
Payload data
{"rets":[0],"gid":"10020","cids":["1234"]}
rets
indicates the operation result. 0
means success. The payload example indicates the MCU has removed the sub-device of 1234
from the group 10020
. You can configure the values that the MCU returns in case of a failed operation.
After the module receives group commands from the mobile app, it sends them to the MCU for execution.
The module sends the following data.
55 AA 00 14 00 0B 05 31 30 30 32 30 01 01 00 01 01 1A
Field | Description |
---|---|
Header | 55 AA |
Command | 00 14 |
Length | 00 0B |
Data |
|
Checksum | 0xE8 |
This command instructs all sub-devices with the group ID of 10020
to execute the action represented by value 1
of the DP ID 1.
The MCU returns the following data.
55 AA 00 14 00 00 13
After executing the specified action, the sub-device needs to proactively report the current status of the DP through the command 0x0D
.
If the MCU fails to report the status, the module will request it through the command 0x29
five seconds later to make sure the value on the mobile app reflects the actual status.
When the MCU sends a group command initiated by local control instead of by app-based remote control, if it fails to instruct sub-devices to proactively report the current status after action execution, the local status will be out of sync with the one displayed on the mobile app. In this case, the MCU can send this command to notify the module of this situation. The module will send the command 0x29
to query the current status of each related DP.
The MCU reports the following data.
55 AA 00 2F 00 18 7B 22 67 69 64 22 3A 22 31 30 30 34 30 22 2C 22 64 70 69 64 22 3A 31 7D A5
Payload data
{"gid":"10040","dpid":1}
This command notifies the module that the status of DP ID 1 in the group of 10040
has been changed locally.
The module returns the following data.
55 AA 00 2F 00 01 00 2F
It indicates the module receives the message.
If the gid
and dpid
in the message are correct, the module will send the command 0x29
to query all the sub-devices for the current status of the related DP.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback