You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 KiB
13 KiB
请求示例
{
"device":"00-10-7a-0f-6d-7a",
"data":{ // 此对象为下面提供的function对象
"name":"set-rpio",
"value":{
"id":"12",
"status":"low"
}
},
"token": ""
}
接口参数数据结构
enum RelayOP {
Low = "low", // 低电位,为开启
High = "high", // 高电位, 为关闭
}
// 咖啡机和门闸暂时没有状态
//--------------------------if 通讯方式为开关量时使用-----------------------------
//原生继电器 // 全设备通用
function relayPacket(id: string, op: RelayOP) {
return {
"name": "set-rpio",
"value": {
"id": id,
"status": op
}
}
}
//原生继电器获取状态 通讯方式为开关量时使用
function relayGetPacket(id: string) {
return {
"name": "get-rpio",
"value": {
"id": id,
}
}
}
//-------------------------------------------------------
//--------------------------if 通讯方式485,且设备类型为 照明/风扇/门禁/水阀 时使用-----------------------------
//485继电器 p为继电器口和原生继电器id意义一致
function relay485Packet(id: string, p: string, o: RelayOP) {
return {
"name": "zzio404d-gpio",
"value": {
"id": id, // 主键id
"p": p, // 子id, 对应 node_id
"o": o, // 设备状态
}
}
}
//获取状态 返回RelayOP
function relay485StatusPacket(id: string, p: string) {
return {
"name": "zzio404d-gpio-status",
"value": {
"id": id,
"p": p,
}
}
}
//-------------------------------------------------------
//--------------------------if 通讯方式Tcp,且设备类型为 照明/风扇/门禁/水阀 时使用-----------------------------
//Tcp继电器 o为空时获取状态
function relayTcpPacket(tcp: string, id: string, p: string, o: RelayOP) {
return {
"name": "zzio404d-gpio-tcp",
"value": {
"tcp": tcp,
"id": id,
"p": p,
"o": o,
}
}
}
//获取状态 返回RelayOP
function relayTcpStatusPacket(tcp: string, id: string, p: string) {
return {
"name": "zzio404d-gpio-status-tcp",
"value": {
"id": id,
"tcp": tcp,
"p": p,
}
}
}
enum AirOP {
status = "status",
on = "on",
off = "off",
}
//--------------------------if 通讯方式485, 设备类型为空调 ,硬件型号为Acmelec 时使用-----------------------------
//485通讯的acmelec
function air485AcmelecPacket(id: string, op: AirOP) {
return {
"name": "acmelec",
"value": {
"id": id,
"op": op,
}
}
}
//--------------------------if 通讯方式485, 设备类型为空调 ,硬件型号为Zhongnan 时使用-----------------------------
//485的中南
function air485ZhongnanPacket(id: string, op: AirOP) {
return {
"name": "zhongnan",
"value": {
"id": id,
"op": op,
}
}
}
//--------------------------if 通讯方式485, 设备类型为空调 ,硬件型号为Jianda 时使用-----------------------------
//485的仁大建科
function air485JiandaPacket(id: string, op: AirOP) {
return {
"name": "ray-air-rs",
"value": {
"id": id,
"op": op,
}
}
}
//--------------------------if 通讯方式tcp, 设备类型为空调 ,硬件型号为Jianda 时使用-----------------------------
//tcp的仁大建科
function airTcpJiandaPacket(tcp: string, id: string, op: AirOP) {
return {
"name": "ray-air-rs-tcp",
"value": {
"tcp": tcp,
"id": id,
"op": op,
}
}
}
enum LockerOP {
status = "status",
on = "on",
}
//--------------------------if 通讯方式485, 设备类型为储物柜时使用-----------------------------
// 开格子的时候你要同时打开多个 所以传多一个"is_delay": true,
//485 储物柜
//tcp 储物柜 cid为硬件地址id id为具体箱子的id
function Locker485Packet(id: string, cid: string, op: LockerOP) {
return {
"name": "lock-b",
"value": {
"id": id,
"cid": cid,
"op": op,
}
}
}
//--------------------------if 通讯方式tcp, 设备类型为储物柜时使用-----------------------------
//tcp 储物柜 cid为硬件地址id id为具体箱子的id
function LockerTcpPacket(tcp: string, cid: string, id: string, op: LockerOP) {
return {
"name": "lock-b-tcp",
"value": {
"tcp": tcp,
"id": id,
"cid": cid,
"op": op,
}
}
}
//--------------------------if 通讯方式tcp, 设备类型为售货柜 硬件型号为 yunyin 时使用-----------------------------
//售货柜出货
function YunyinPacket(tcp: string, id: string) {
//请求三次接口 重置 开启 重置
return [
{
"name": "yunyin-reseq",
"value": {
"tcp": tcp,
"id": id,
}
},
{
"name": "yunyin-pop",
"value": {
"tcp": tcp,
"id": id,
}
},
{
"name": "yunyin-reseq",
"value": {
"tcp": tcp,
"id": id,
}
},
]
}
//获取yunyin机器码
function YunyinMacPacket(tcp: string) {
return [
{
"name": "yunyin-mac",
"value": {
"tcp": tcp,
}
}
]
}
enum CoffeeboxTemperature {
hot = "hot", //热
cold = "cold", //冷
}
//--------------------------if 通讯方式tcp, 设备类型为咖啡机 硬件型号为 miaoque 时使用-----------------------------
function CoffeeboxPacket(tcp: string, id: string, t: CoffeeboxTemperature) {
return {
"name": "coffeebox-tcp",
"value": {
"tcp": tcp,
"id": id,
"t": t,
}
}
}
//--------------------------if 通讯方式tcp, 设备类型为门闸时使用-----------------------------
//门闸
function GatePacket(tcp: string, cid: string,) {
return {
"name": "gate",
"value": {
"tcp": tcp,
"cid": cid, //进出控制ID |进入-> enter_id 离开-> leave_id|
},
"is_delay": true,
"queue_group": "gate",
}
}
2021-07 新增
通知中控播放音响 sendPacket
https://testmanager.ouxuanzhineng.cn/ouxuanac/sendPacket
//请求参数
{
"device": "设备名",
"data": {
"name": "audio-player",
"value": {
"url": "语音url"
}
},
"token": "f0d5c19b-b87e-11eb-bc7d-5254005df464"
}
//例子
{
"device": "00-10-7a-0f-6d-7a",
"data": {
"name": "audio-player",
"value": {
"url": "https://test.ouxuanzhineng.cn/ouxuanac/tts/textToVoice.wav?text=试试看&voice_type=4&speed=-1&volume=10"
}
},
"token": "f0d5c19b-b87e-11eb-bc7d-5254005df464"
}
文字转语音 textToVoice
https://test.ouxuanzhineng.cn/ouxuanac/tts/textToVoice.wav?text=试试看&voice_type=4&speed=-1&volume=10
查询中控在线状态 getDescribeDevice
示例:
https://testmanager.ouxuanzhineng.cn/ouxuanac/deviceQuery?id=00-de-47-e9-3a-fc
返回:
{"code":0,"data":{"DeviceName":"00-de-47-e9-3a-fc","Online":1,"LoginTime":1626126211,"LastUpdateTime":1624102433,"Tags":[{"Tag":"category","Type":2,"Value":"placeholder","Name":""},{"Tag":"note","Type":2,"Value":"锐那东方渔人码头店","Name":""}],"DeviceType":5,"ConnIP":1231216393,"FirstOnlineTime":1602899627,"LastOfflineTime":1626126208,"LastOfflineTimeStr":"2021-07-13 05:43:28","CreateTime":1602899594,"EnableState":1,"ClientIP":"36.113.100.107","RequestId":"fc49e900-2b4c-403b-bf00-d929725d2276"},"message":""}
获取定时列表 sendPacket
请求参数
{
"device": "00-10-7a-0f-6d-7a",
"data": {
"name": "get-time-select",
"value": {}
}
}
返回:
{"code":0,"data":[{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,5,4,6],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明8","value":{"id":"8","status":"low"}}},"extension":null,"group":"RPIO","time_arrow_id":"7d56981c-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:12:00-10:12:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,6,5,4],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明9","value":{"id":"9","status":"low"}}},"extension":null,"group":"RPIO","time_arrow_id":"862813af-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:12:00-10:12:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,4,1,5,2,6,3],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明10","value":{"id":"10","status":"low"}}},"extension":null,"group":"RPIO","time_arrow_id":"8def57e1-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:12:00-10:12:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,6,5,4],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明8","value":{"id":"8","status":"high"}}},"extension":null,"group":"RPIO","time_arrow_id":"be5eb915-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:13:00-10:13:10"],"type":"DAY_OF_WEEK","weights":0},{"date_slice":[{"end":"","start":""}],"day_of_month":null,"day_of_week":[0,1,2,3,6,5,4],"expand_tags":null,"expand_value":{"main":{"name":"set-rpio","title":"测试中控照明9","value":{"id":"9","status":"high"}}},"extension":null,"group":"RPIO","time_arrow_id":"c8c39f5c-8dd4-11eb-9aad-4e965989bbce","times_on_day":["10:13:00-10:13:10"],"type":"DAY_OF_WEEK","weights":0}],"message":""}
删除定时任务 sendPacket
请求参数
{
"device": "00-10-7a-0f-6d-7a",
"delay": 1,
"data": {
"name": "delete-time-select",
"value": {
"uuid": "d185c9f8-8dd4-11eb-9aad-4e965989bbce"
}
}
}
<dict>
<key>devicePlatform</key>
<string>ios</string>
<key>deviceIdentifier</key>
<string>00008027-000D452836E8002E</string>
<key>audo-0714-01</key>
<string>iPad-Pro3-12.9-inch1</string>
</dict>
小程序端定时任务设置 sendPacket(reqData)
switchData(开关命令数据)->postData(后台定时接口数据)->reqData(组成最终小程序端中控定时数据)
- 接口复用sendPacket 测试集合:sendPacket
- 需了解后台接口SetTimeSelect规则 SetTimeSelect
- 需了解参数中group定义由来: 设备管理-硬件设备-连接方式
- 区分开关状态需要传输的value
照明,风扇,水阀
//都是GPIO 其他设备应该也可以用这种方式设置
{
"name": "继电器",
"value": "Gpio"
},
//value区分
风扇: 水阀: 照明: data.value.status 开:low , 关:high
在sendPacket接口中的传递定时任务参数 reqData
//接口地址
http://api.ouxuan.net/project/233/interface/api/10012 (原接口地址)
http://api.ouxuan.net/project/233/interface/case/1860 (设置定时任务接口地址: 后台说那边同个接口只能添加一个)
例子:
{
"device": "00-10-7a-0f-6d-7a",
"delay": 1,
"data": {
"name": "set-time-select",
"value": {
"data": "传入设置的json格式字符串,例如:{\"time_arrow_id\":\"c8c39f5c-8dd4-11eb-9aad-4e965989bbce\",\"group\":\"RPIO\",\"type\":\"DAY_OF_WEEK\",\"day_of_week\":[0,1,2,3,6,5,4],\"day_of_month\":null,\"date_slice\":[{\"start\":\"\",\"end\":\"\"}],\"times_on_day\":[\"10:13:00-10:13:10\"],\"expand_tags\":null,\"expand_value\":{\"main\":{\"name\":\"set-rpio\",\"title\":\"测试中控照明9\",\"value\":{\"id\":\"9\",\"status\":\"high\"}}},\"weights\":0,\"extension\":null}"
}
}
}
定时任务参数参考后台管理端api postData
http://api.ouxuan.net/project/165/interface/api/8194
参数规则:
{
"time_arrow_id": "c8c39f5c-8dd4-11eb-9aad-4e965989bbce", //不用填 留空
"group": "RPIO", //照明,风扇,空调固定值
"type": "DAY_OF_WEEK", //DAY_OF_WEEK/DAY_OF_MONTH/DATE_SLICE , 对应 周,月,单独时间.
"day_of_week": [
0,
1,
2,
3,
6,
5,
4
],
"day_of_month": null,
"date_slice": [
{
"start": "",
"end": ""
}
],
"times_on_day": [
"10:13:00-10:13:10"
],
"expand_tags": null,
"expand_value": {
"main": { //中控指令
"name": "set-rpio",
"title": "测试中控照明9",
"value": {
"id": "9",
"status": "high"
}
}
},
"weights": 0,//权重
"extension": null
}
关于switchData
postData.expand_value.main = switchData
switchData 为 switch_manage.vue 中的开关指令