Device
1. report_device(device)
Report a piece of device status.
Parameters: device (Device)
| Name | Type | Description |
|---|---|---|
| device | object | a device object |
| uid | string(uuid) | a unique decorator to differ it |
| name | string | a name for human to read |
| x,y,z | string | location description of the device |
| context | dict | description of environment |
Parameters Example:
# build device through dict
tar = {
"id": 1234,
"name": "NAME",
"uid": "MAC",
"x": "X",
"y": "Y",
"z": "Z",
"context":{
"type": "TYPE",
"states":"",
"value":"",
"admin":"admin_name"
}
}
device = Device(tar)
# you can also build it by setting properties one by one
cloud.iot.report_device(device)
Return value: Device Object
Return value example:
istack/iot/v1/device Device
uid : 10.200.42.138
name : inesa device
x : 1
y : 1
z : 1
timestamp : 1902305466520
context:
{
‘type’:’TYPE’,
‘state’:’xyz’,
‘admin’:’admin’
}
2. delete_device(device)
Delete device reports related to specified.
Parameters: device (Device) # target device, at least id specified inside
| Name | Type | Description |
|---|---|---|
| device | object | a device object |
| uid | string(uuid) | a unique decorator to differ it |
| name | string | a name for human to read |
| x,y,z | string | location description of the device |
| context | dict | description of environment |
Parameters Example:
# build device through dict
tar = {
"id": 1234,
"name": "NAME",
}
device = Device(tar)
cloud.iot.delete_device(device)
Return value: Device Object # 已删除device
Return value example: As above, and it is no longer useful
istack/iot/v1/device Device
uid : 10.200.42.138
name : inesa device
x : 1
y : 1
z : 1
timestamp : 1902305466520
context:
{
‘type’:’TYPE’,
‘state’:’xyz’,
‘admin’:’admin’
}