产品
产品流文件
- 流文件适用厂商
珠海市泥人电子科技有限公司
网址: https://www.nirenelec.com
- 流文件适用厂商产品
网络语音控制器 NR-C2201V
- 流文件
[
{
"id": "63d1d542f3f0f7ee",
"type": "tab",
"label": "语音播报控制器",
"disabled": false,
"info": ""
},
{
"id": "e6476e233ad7c078",
"type": "tcp out",
"z": "63d1d542f3f0f7ee",
"host": "192.168.1.3",
"port": "12345",
"beserver": "client",
"base64": false,
"end": false,
"name": "TCP服务",
"x": 720,
"y": 300,
"wires": []
},
{
"id": "bc1031f7a71f350f",
"type": "mqtt in",
"z": "63d1d542f3f0f7ee",
"name": "语音播放控制",
"topic": "/edgebox/edgebox02/child/niren_voice_ctl_02/function/invoke",
"qos": "0",
"datatype": "json",
"broker": "534d0e6087f67d4e",
"nl": false,
"rap": false,
"inputs": 0,
"x": 210,
"y": 300,
"wires": [
[
"21fe70c5eb30bdce",
"1c571ec9563a023d"
]
]
},
{
"id": "21fe70c5eb30bdce",
"type": "function",
"z": "63d1d542f3f0f7ee",
"name": "设备控制",
"func": "var functionId = msg.payload.functionId;\nif(\"play_ctl\"==functionId){\n msg.payload = \"AT+TTS1=\"\n +msg.payload.inputs[0].value\n +\",0,\"\n +msg.payload.inputs[1].value.length*2\n +\"\\n\"\n +msg.payload.inputs[1].value; \n}else{\n \n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 300,
"wires": [
[
"1159a230392696d6"
]
]
},
{
"id": "1c571ec9563a023d",
"type": "function",
"z": "63d1d542f3f0f7ee",
"name": "控制回复",
"func": "var edgeboxId = \"edgebox02\";\nvar deviceId = \"niren_voice_ctl_02\";\n\nvar data = msg.payload;\nvar payload = {\n messageId:data.messageId,\n deviceId:deviceId\n};\nmsg.payload = payload;\nmsg.topic = \"/edgebox/\"+edgeboxId+\"/child/\"+deviceId+\"/function/invoke/reply\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 400,
"y": 360,
"wires": [
[
"dd907248745ee6c6"
]
]
},
{
"id": "dd907248745ee6c6",
"type": "mqtt out",
"z": "63d1d542f3f0f7ee",
"name": "消息发布",
"topic": "",
"qos": "0",
"retain": "false",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "534d0e6087f67d4e",
"x": 720,
"y": 360,
"wires": []
},
{
"id": "1159a230392696d6",
"type": "converter",
"z": "63d1d542f3f0f7ee",
"name": "GB2312",
"from": "GB2312",
"x": 560,
"y": 300,
"wires": [
[
"e6476e233ad7c078"
]
]
},
{
"id": "ccd3034d9bb5694e",
"type": "status",
"z": "63d1d542f3f0f7ee",
"name": "",
"scope": [
"e6476e233ad7c078"
],
"x": 230,
"y": 420,
"wires": [
[
"e147e48d1657ac23"
]
]
},
{
"id": "e147e48d1657ac23",
"type": "function",
"z": "63d1d542f3f0f7ee",
"name": "设备状态监测",
"func": "msg.edgeboxId = \"edgebox02\";\nmsg.payload = {\n deviceId:\"niren_voice_ctl_02\"\n};\n\nif(msg.status.text == \"common.status.connected\"){\n return [msg,null];\n}\nreturn [null,msg];",
"outputs": 2,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 420,
"y": 420,
"wires": [
[
"7a9e0f598639a3e0"
],
[
"6855d98d2e9431ab"
]
]
},
{
"id": "6855d98d2e9431ab",
"type": "function",
"z": "63d1d542f3f0f7ee",
"name": "下线",
"func": "// 全局变量设置,用于避免重复上报\nvar payload = \"offline\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(msg.payload.deviceId) == flow_str){\n return null;\n}\nflow.set(msg.payload.deviceId,flow_str);\nglobal.set(msg.payload.deviceId,{device_state:false});\n\nmsg.topic = \"/edgebox/\"+msg.edgeboxId+\"/child/\"+msg.payload.deviceId+\"/offline\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 570,
"y": 440,
"wires": [
[
"dd907248745ee6c6"
]
]
},
{
"id": "7a9e0f598639a3e0",
"type": "function",
"z": "63d1d542f3f0f7ee",
"name": "上线",
"func": "// 全局变量设置,用于避免重复上报\nvar payload = \"online\";\nvar flow_str = JSON.stringify(payload);\nif(flow.get(msg.payload.deviceId) == flow_str){\n return null;\n}\nflow.set(msg.payload.deviceId,flow_str);\nglobal.set(msg.payload.deviceId,{device_state:true});\n\nmsg.topic = \"/edgebox/\"+msg.edgeboxId+\"/child/\"+msg.payload.deviceId+\"/online\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 570,
"y": 400,
"wires": [
[
"dd907248745ee6c6"
]
]
},
{
"id": "534d0e6087f67d4e",
"type": "mqtt-broker",
"name": "飞企IOT-MQTT",
"broker": "10.62.16.222",
"port": "31884",
"clientid": "edgebox02",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"birthTopic": "/edgebox/edgebox02/online",
"birthQos": "0",
"birthPayload": "{\"deviceId\":\"edgebox02\" }",
"birthMsg": {},
"closeTopic": "/edgebox/edgebox02/offline",
"closeQos": "0",
"closePayload": "{\"deviceId\":\"edgebox02\" }",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
}
]
- 导入编排引擎
产品设备上线
文档更新时间: 2022-09-09 18:01 作者:管理员