# Equipment Group
For some scenarios that require batch operations on devices, this can be done through device groups.
# 1. Limitations of Device Groups
- Up to one device group to add 50 Each device, a device can belong to only one device group.
- Devices within the same device group must belong to the same type of device(model_type), for exampleCampus Phone, but not necessarily the same device model(model_id)。
- The device group must go through the background API Created, After CreatedModifying the name of a device group is not allowedThe user sees the name of the device group when authorizing and receiving calls, and cannot be customized for the user.
# 2. Manage Device Group
Developers can add, delete, change and check device groups through the following background interfaces.
The developer needs to maintain the set of all device groups created group_ID is used for subsequent inquiries and authorization. WeChat only do verification, do not maintain all created under the Mini Program group_id List.
- Create a device group
- Remove a device from a device group
- Add a device to a device group
- [Query Device Group Information]((getIotGroupInfo ))
Note:
In addition to adding devices when the device group is created, generally adding or deleting devices should only occur in scenarios such as adding devices, equipment damage replacement, and equipment abolition. Ask developers to keep the devices in the device group relatively stable and avoid changing the composition of the device group too often.
WeChat will monitor the operation of the device group and ask the mini program administrator to manually confirm it if necessary. In this case, the device group action takes effect after the administrator confirms it.
# 3. Applicable scenario
Currently available forEquipment Volume LicensingThe scene.
# 4. Troubleshooting guidelines
# 4.1 Why was the device added to the device group before, but can not be found in the device group?
- May have been invoked by some other logic
removeIotGroupDevice
Remove a device from a device group - May be used elsewhere
addIotGroupDevice
(force_add=true) Forcing a device to a different device group will also cause the device to be removed from the previous group.
# 4.2 When a user authorizes a device group, it still prompts for unauthorized devices(errCode = 9)How to check?
Devices using a device group, if the prompt is not authorized, there are several possibilities
- The user does not authorize the device group, or the user once authorizedClear or Cancel Authorization
- Can be usedAuthorization status query Interface, judging the user and device/Whether the device group directly has an authorization relationship
- The user has authorized the device group, but the device is not in the group.
- Can be used [getIotGroupInfo ]((getIotGroupInfo )) Query the device list in the device group.
# 4.3 A、B Both users authorized the device group X, but A Can access the equipment in the equipment group X1,B But not?
Generally due to the user A And devices already have direct authorization (not through device groups). Hypothetical device X1 Present in the device group X In.
- user A Simultaneous Authorization Device Group X And Direct Authorization Devices X1。At this time, even if the equipment X1 Removed from the device group X, User A Can still call the device.
- user B Authorized Device Groups Only X。Equipment at this time X1 Removed Device Group X Later, the user B Can't call the device.