涂鸦接口测试情况
## 涂鸦接口测试情况
#### 1. 接口
- 创建涂鸦账号
- 添加设备到涂鸦账号:发现设备之前,需要先申请一个临时令牌,经过涂鸦客户端SDK进行配网,设备接到token后可自动完成发现和账号绑定,所以没有该接口。
- 删除指定设备
- 修改指定设备名称
- 获取指定设备详细信息(包括当前上线/下线状态,工作状态数据)
- 控制设备(打开/关闭,倒计时打开/关闭)
- 订阅设备消息(设备上线/下线,设备打开/关闭):https://www.bookstack.cn/read/pulsar-v2.4/bcd418c976db5761.md
- 获取涂鸦账号下的设备列表
#### 2. 接口测试日志
```
get_user
{
'result': {
'has_more': False,
'list': [
{
'create_time': 1597894707,
'email': 'samdy.chen@visionwx.com',
'uid': 'ay1597894707573xs9WQ',
'update_time': 1597894707,
'username': 'samdy.chen@visionwx.com'
}
]
},
'success': True,
't': 1597894707898
}
get user ticket, https://openapi.tuyacn.com/v1.0/users/ay1597894707573xs9WQ/ticket
{
'result': {
'expire_time': 300,
'ticket': 'ST-a87326eeb5188eed43867909418666a9DFqakhJIWoDPRueHXW7s'
},
'success': True,
't': 1597895092998
}
get_user_info: https://openapi.tuyacn.com/v1.0/users/ay1597894707573xs9WQ/infos
{
'result': {
'avatar': '',
'country_code': '86',
'create_time': 1597894707,
'email': 'samdy.chen@visionwx.com',
'nick_name': '',
'uid': 'ay1597894707573xs9WQ',
'update_time': 1597895092,
'user_properties': [],
'username': 'samdy.chen@visionwx.com'
},
'success': True,
't': 1597895262467
}
get_device_info: https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a
{
'result': {
'active_time': 1597980914,
'biz_type': 0,
'category': 'cz',
'create_time': 1597980914,
'icon': 'smart/icon/1544497477d9f1uf1hbq5_0.jpg',
'id': '4834120498f4abfcc35a',
'ip': '117.136.40.200',
'local_key': '93f2ad8830241863',
'name': 'door',
'online': True,
'owner_id': '22458363',
'product_id': 'xvsgeeru2i5wsd0y',
'product_name': 'door',
'status': [
{'code': 'switch', 'value': True},
{'code': 'countdown_1', 'value': 0}
],
'sub': False,
'time_zone': '+08:00',
'uid': 'ay15956109400526lf4b',
'update_time': 1597980920,
'uuid': '4834120498f4abfcc35a'
},
'success': True,
't': 1597987045275
}
get_user_device_list: https://openapi.tuyacn.com/v1.0/users/ay15956109400526lf4b/devices
{
'result': [
{
'active_time': 1597980914,
'biz_type': 0,
'category': 'cz',
'create_time': 1597980914,
'icon': 'smart/icon/1544497477d9f1uf1hbq5_0.jpg',
'id': '4834120498f4abfcc35a',
'ip': '117.136.40.200',
'local_key': '93f2ad8830241863',
'name': 'door',
'online': True,
'owner_id': '22458363',
'product_id': 'xvsgeeru2i5wsd0y',
'product_name': 'door',
'status': [{'code': 'switch', 'value': True}, {'code': 'countdown_1', 'value': 0}],
'sub': False,
'time_zone': '+08:00',
'uid': 'ay15956109400526lf4b',
'update_time': 1597980920,
'uuid': '4834120498f4abfcc35a'
},
{
'active_time': 1597841947,
'biz_type': 0,
'category': 'mcs',
'create_time': 1597841947,
'icon': 'smart/icon/1551922155tfu0amusc9_0.png',
'id': 'vdevo159784194749480',
'ip': '116.6.88.34',
'local_key': '73518151327f0884',
'name': '海曼门磁-vdevo',
'online': True,
'owner_id': '22458363',
'product_id': 'ho6i0zk9',
'product_name': '海曼门磁',
'status': [
{'code': 'doorcontact_state', 'value': False},
{'code': 'battery_percentage', 'value': 0},
{'code': 'temper_alarm', 'value': False}
],
'sub': False,
'time_zone': '',
'uid': 'ay15956109400526lf4b',
'update_time': 1597841947,
'uuid': 'vdevo159784194749480'
},
{
'active_time': 1597841905,
'biz_type': 0,
'category': 'rqbj',
'create_time': 1597841905,
'icon': 'smart/icon/1544446654ymiio0z7sbr_0.png',
'id': 'vdevo159784190519746',
'ip': '116.6.88.34',
'local_key': '6fba740ee9893254',
'name': '燃气报警器-vdevo',
'online': True,
'owner_id': '22458363',
'product_id': '18pkine6',
'product_name': '可燃 气体报警器(海外)',
'status': [{'code': 'gas_sensor_state', 'value': '1'}],
'sub': False,
'time_zone': '',
'uid': 'ay15956109400526lf4b',
'update_time': 1597841905,
'uuid': 'vdevo159784190519746'
},
{'active_time': 1597841825, 'biz_type': 0, 'category': 'pir', 'create_time': 1597841825, 'icon': 'smart/icon/1551922141jvsday0aq8_0.png', 'id': 'vdevo159784182518245', 'ip': '116.6.88.34', 'local_key': '9ad97e0568e2c4d2', 'name': '人体红外探测器-vdevo', 'online': True, 'owner_id': '22458363', 'product_id': 'mrwlggy8', 'product_name': '海曼人体红外传感', 'status': [{'code': 'pir', 'value': 'pir'}, {'code': 'battery_percentage', 'value': 0}, {'code': 'temper_alarm', 'value': False}], 'sub': False, 'time_zone': '', 'uid': 'ay15956109400526lf4b', 'update_time': 1597841825, 'uuid': 'vdevo159784182518245'},
{'active_time': 1597841753, 'biz_type': 0, 'category': 'qn', 'create_time': 1597841547, 'icon': 'smart/icon/qn01.png', 'id': 'vdevo159784154715582', 'ip': '116.6.88.34', 'local_key': '4d2fbb865ddddf51', 'name': '众邦取暖器-vdevo', 'online': True, 'owner_id': '22458363', 'product_id': '11', 'product_name': '众邦取暖器', 'status': [{'code': 'switch', 'value': False}], 'sub': False, 'time_zone': '', 'uid': 'ay15956109400526lf4b', 'update_time': 1597841753, 'uuid': 'vdevo159784154715582'},
{'active_time': 1597841690, 'biz_type': 0, 'category': 'cz', 'create_time': 1597841690, 'icon': 'smart/icon/ay1477972394003tCUfv/1558143483e05397afc67.jpg', 'id': 'vdevo159784169024714', 'ip': '116.6.88.34', 'local_key': 'fa72fc5e9e62ee1a', 'name': 'ZigBee Valve-vdevo', 'online': True, 'owner_id': '22458363', 'product_id': 'ymcdbl3u', 'product_name': 'ZigBee Valve', 'status': [{'code': 'switch_1', 'value': True}, {'code': 'countdown_1', 'value': 0}], 'sub': False, 'time_zone': '', 'uid': 'ay15956109400526lf4b', 'update_time': 1597841690, 'uuid': 'vdevo159784169024714'},
{'active_time': 1597841650, 'biz_type': 0, 'category': 'kg', 'create_time': 1597841650, 'icon': 'smart/icon/ay1535358675827bsYdl/a76162ae18c1b0d7650c0716756762e5.png', 'id': 'vdevo159784165074640', 'ip': '116.6.88.34', 'local_key': 'a9e463c321e627fc', 'name': 'seebest六键场景开关-vdevo', 'online': True, 'owner_id': '22458363', 'product_id': 'CvX0ntfj', 'product_name': '六键场景开关(ZigBee)', 'status': [], 'sub': False, 'time_zone': '', 'uid': 'ay15956109400526lf4b', 'update_time': 1597841650, 'uuid': 'vdevo159784165074640'},
{'active_time': 1597841133, 'biz_type': 0, 'category': 'kg', 'create_time': 1597841133, 'icon': 'smart/icon/ay1555554440613JOXol/fc424cfda62ba1d4a58b54baa45acb23.jpg', 'id': 'vdevo159784113327697', 'ip': '116.6.88.34', 'local_key': '764730354bbe9448', 'name': '鸿雁二路开关-vdevo', 'online': True, 'owner_id': '22458363', 'product_id': 'QbM41I6K', 'product_name': '鸿雁双键智能开关U1', 'status': [{'code': 'switch_1', 'value': True}, {'code': 'switch_2', 'value': False}], 'sub': False, 'time_zone': '', 'uid': 'ay15956109400526lf4b', 'update_time': 1597841133, 'uuid': 'vdevo159784113327697'},
{'active_time': 1597841029, 'biz_type': 0, 'category': 'cl', 'create_time': 1597841029, 'icon': 'smart/icon/ay1555554440613JOXol/406ec9246254ba5b67bd6e278ee26761.jpg', 'id': 'vdevo159784102973095', 'ip': '116.6.88.34', 'local_key': 'cd8ebf56b4d71625', 'name': '窗帘开关-vdevo', 'online': True, 'owner_id': '22458363', 'product_id': 'LW1N04eB', 'product_name': '鸿雁单路窗帘开关U1', 'status': [{'code': 'control', 'value': 'open'}], 'sub': False, 'time_zone': '', 'uid': 'ay15956109400526lf4b', 'update_time': 1597841029, 'uuid': 'vdevo159784102973095'}
],
'success': True,
't': 1597987225399
}
get_device_log: https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a/logs?type=1,2&start_time=0&end_time=1597988145663&size=20
{
'result': {
'current_row_key': 'OTUxYjU1NzNhNTNjY2ZiYTRmODk0MDIxNDM4NF85MjIzMzcwNDM4ODczODU5MTU4XzE=',
'device_id': '4834120498f4abfcc35a',
'has_next': False,
'logs': [
{'event_from': '1', 'event_id': 1, 'event_time': 1597980916649, 'status': '1'}
]
},
'success': True,
't': 1597988147396
}
update_device_name, https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a
{'result': True, 'success': True, 't': 1597990793765}
get_device_status: https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a/status
{
'result': [
{'code': 'switch', 'value': True},
{'code': 'countdown_1', 'value': 0}
],
'success': True,
't': 1597991075773
}
get_device_functions: https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a/functions
{
'result': {
'category': 'cz',
'functions': [
{'code': 'switch', 'desc': '开关', 'name': '开关', 'type': 'Boolean', 'values': '{}'},
{'code': 'countdown_1', 'desc': '开关1倒计时', 'name': '开关1倒计时', 'type': 'Integer', 'values': '{"unit":"s","min":0,"max":86400,"scale":0,"step":1}'}
]
},
'success': True,
't': 1597991241447
}
get_device_specifications: https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a/specifications
{
'result': {
'category': 'cz',
'functions': [
{'code': 'switch', 'type': 'Boolean', 'values': '{}'},
{'code': 'countdown_1', 'type': 'Integer', 'values': '{"unit":"s","min":0,"max":86400,"scale":0,"step":1}'}
],
'status': [
{'code': 'switch', 'type': 'Boolean', 'values': '{}'},
{'code': 'countdown_1', 'type': 'Integer', 'values': '{"unit":"s","min":0,"max":86400,"scale":0,"step":1}'}
]
},
'success': True,
't': 1597991797850
}
command_device: https://openapi.tuyacn.com/v1.0/devices/4834120498f4abfcc35a/commands
command = {
"commands":[
{
"code":"switch",
"value": False
}
]
}
command = {
"commands":[
{
"code":"countdown_1",
"value": 5
}
]
}
{'result': True, 'success': True, 't': 1597992171005}
```