Device Proxy
Overview
The IoT platform provides the device proxy function when the topology relationship between gateways and child devices is not fixed.
The device topology is decoupled from the data forwarding capability. A child device can select a device that is not in the topology relationship with it to forward data.

Scenarios
- Gateway high availability (HA) solution with active/standby gateway switch: In a tunnel scenario, the standby gateway seamlessly assumes data transmission if the active gateway's network connection is poor or fails, ensuring uninterrupted and reliable data transmission.
- Child device migration for data forwarding upon gateway fault: Currently, when a gateway is faulty, the platform needs to delete the associated child devices and register them with a new gateway. After this device proxy is enabled, data can be transmitted through the new gateway without deleting the original gateway.
- Unassociated mobile devices and gateway requiring flexible gateway selection for data forwarding: For example, a mobile diagnostic cart with a medical device sensor must promptly transmit data to the medical center system after bedside diagnosis and treatment. To facilitate real-time information transmission, each ward is equipped with an IoT gateway for device data uploads, with the mobile diagnostic cart selecting the current ward gateway for reporting data.
Functions
- IoTDA provides the device proxy function to decouple the device topology from data forwarding, allowing data to be forwarded through various gateways while the device topology remains fixed upon registration. You can define and manage device proxy policies from two dimensions.
- Time dimension: A time limit may be set for the forwarding permission of the proxy device. Once the time limit expires, the device no longer has the proxy capability.
- Space dimension: Devices (gateways) in the same device proxy group can forward data from all their child devices.
- A child device can only be connected to one gateway at a time for data forwarding. To manage data forwarding for multiple child devices, set up the gateway proxy relationship in advance and use the required gateway to report the status of the target child device, enabling the switchover to the designated gateway. When the gateway reports that the child device is online, the platform verifies the proxy relationship between the gateway and the device. Upon successful verification, the platform switches the child device's gateway to the designated proxy gateway, allowing data forwarding through the new gateway. If the gateway reports the child device as offline, it no longer serves as the proxy gateway and cannot forward data for the child device.

- The device can report data only through the latest gateway (the proxy gateway in this case). If the device reports data through other gateways (including the gateway specified during device creation), the verification fails.
- When the platform delivers a child device message, if a valid proxy relationship exists, the message is sent to the proxy gateway. If no proxy relationship exists, the message is sent to the gateway specified when the child device is created.
- To use this function, submit a service ticket.
Constraints
- The maximum TPS for an account to call this API is 1 (one request per second).
- Max. device proxy groups for an instance: 10
- Max. devices in a device proxy group: 10
- Only directly connected devices and gateways can be added to device proxy groups. Child devices cannot be added to device proxy groups.
- A device can be added to only one device proxy group.
Procedure
- Access the IoTDA service page and click Access Console. Click the target instance card.
- In the navigation pane, choose Devices > All Devices, click Register Device, and set parameters to create required devices. Example: gateway A (deviceproxy-gateway1) and its child devices gateway1-subdevice-1 and gateway1-subdevice-2; gateway B (deviceproxy-gateway2) and its child devices gateway2-subdevice-1 and gateway2-subdevice-2.
Figure 2 Device - Registering a device proxy
- Click the Device Proxy tab, click Create Proxy Group, and select the two gateways created in the previous step.
Figure 3 Device proxy - Details
- Use the gateway A to report the status of gateway B's child devices (gateway2-subdevice-2 and gateway2-subdevice-1). Enter the actual device ID.
Topic: $oc/devices/{device_id}/sys/events/up Data format: { "object_device_id": "********_deviceproxy-gateway1", "services": [{ "service_id": "$sub_device_manager", "event_type": "sub_device_update_status", "event_time": "20151212T121212Z", "paras": { "device_statuses": [{ "device_id": "********_gateway2-subdevice-2", "status": "ONLINE" }, { "device_id": "********_gateway2-subdevice-1", "status": "ONLINE" } ] } }] }
- Gateway A receives a response to the request for reporting the child device status.
Topic: $oc/devices/{device_id}/sys/events/down Data format: { "object_device_id": "********_deviceproxy-gateway1", "services": [ { "service_id": "$sub_device_manager", "event_type": "sub_device_update_status_response", "event_time": "20151212T121212Z", "event_id": "********", "paras": { "successful_devices": [ { "device_id": "********_gateway2-subdevice-2", "status": "ONLINE" }, { "device_id": "********_gateway2-subdevice-1", "status": "ONLINE" } ], "failed_devices": [ ] } } ] }
- On the All Devices page of the console, check whether the two child devices are online. If yes, their proxy gateways have been switched to deviceproxy-gateway1. You can perform operations on the child devices through the proxy gateway. The following uses data reporting as an example.
Figure 4 Device proxy - Device status
- Use gateway A to report data of the two child devices of gateway B.
Topic: $oc/devices/{device_id}/sys/gateway/sub_devices/properties/report Data format: { "devices":[ { "device_id":"********_gateway2-subdevice-2", "services":[ { "service_id":"BasicData", "properties":{ "luminance":"12" }, "event_time":"20200702T121212Z" } ] }, { "device_id":"********_gateway2-subdevice-1", "services":[ { "service_id":"BasicData", "properties":{ "luminance":"66" }, "event_time":"20200702T121212Z" } ] } ] }
- On the device details page, check the data reported by the device.
Figure 5 Device details - Proxy child device
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot