BatchGetDeviceState

Last Updated on : 2025-10-09 10:30:15Copy for LLMView as Markdown

You can call this operation to view the running status of a specified device in batches, including the current status of the device, the time when the device status was changed, and the time when the device was last online.

Instructions for use

When calling this interface:

  • Request parameters are passed in at the same time ProductKey and multiple DeviceName : Query the running status of multiple devices of the same product.

  • Request parameters passed in multiple IoTID : Can be passed into equipment under different products. IoTIDto query the running status of equipment under different products.

Request Parameters

Name Type Required Sample Values Description
Action String Yes BatchGetDeviceState System defined parameters. Value: BatchGetDeviceState.
DeviceName.N RepeatList No Light List of names of devices for which you want to view the running status.
ProductKey String No A1BwAGV * * * * To view the running status of the device belonging to the product ProductKey .
IoTID.N RepeatList No **** 00100 The list of device IDs for which you want to view the running status.

Note: When calling an API, in addition to the API-specific request parameters described in this topic, you must also pass in the common request parameters. For more information about common request parameters, see Common parameters.

Return data

Name Type Sample Values Description
Code String Iot.system.SystemException The error code returned when the call fails. For more information, see Error codes.
DeviceStatusList Array of DeviceStatus When the call is successful, a list of device status information is returned. For details, see DeviceStatus parameter under.
DeviceStatus
AsAddress String 192.0.2.1 The IP address of the device.
DeviceID String DwnS41bhNxjslDAI * * * * The device ID (legacy parameter).
DeviceName String Light The device name.
IoTID String DwnS41bhNxjslDAI **** 000100 The device ID, which is the unique identifier issued by IoT platform for the device.
LastOnlineTime String 2020-01-17 16:19:11 The last time the device went online.
Status String Offline Device status. Value: ●Online : equipment online. ●Offline : The device is offline. ●Unactive : The device is not activated. ●Disable : Device is disabled.
Timestamp Long 1557062301656 Device status change time. The unit is milliseconds.
ErrorMessage String System Exception Error information returned when the call fails.
RequestID String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 The unique identifier generated by the request.
Success Boolean True Whether the call was successful. ●True : The call succeeded. ●False : The call failed.

Example

Request Example

curl 'https://si-d6e8d8******8958054.tuyacloud.com:8686/?Action=BatchGetDeviceState&SignatureNonce=49f75ea4eedb42fc871d4038feb1efaa&AccessKeyId=xMr9wgwXQLhv5AUa65o03mcD&DeviceName.1=myTestDevice&SignatureMethod=HMAC-SHA1&Timestamp=2024-11-19T08%3A37%3A03Z&ProductKey=k1ymv1DuLfE&Signature=JpEmjXliI2FSoMXxATKgmxCoVVA%3D'

Normal return example

{
	"DeviceStatusList": {
		"DeviceStatus": [
			{
				"Status": "OFFLINE",
				"DeviceId": "dwnS41bhNxjslDAI****",
				"DeviceName": "Humidity",
				"AsAddress": "192.0.2.1",
				"LastOnlineTime": "2020-01-17 16:19:11",
                "Timestamp":1557062301656,
				"IotId": "dwnS41bhNxjslDAI****000100"
			}
		]
	},
	"RequestId": "3258D872-EDC5-4039-B564-C27ED7176741",
	"Success": true
}