[
{
"id": "ca748038f2e9d7e7",
"type": "inject",
"z": "e4d14b7b7c8cb544",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "*/10 16-22 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 980,
"wires": [
[
"acf31b7fb59fe97f"
]
]
},
{
"id": "acf31b7fb59fe97f",
"type": "api-call-service",
"z": "e4d14b7b7c8cb544",
"name": "",
"server": "43f262e223290729",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "turn_on",
"areaId": [],
"deviceId": [],
"entityId": [
"light.044_esp32_cam_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 270,
"y": 1020,
"wires": [
[
"5ff49914493234d2"
]
]
},
{
"id": "979b5f4c33caf08f",
"type": "inject",
"z": "e4d14b7b7c8cb544",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "*/10 5-12 * * *",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 1020,
"wires": [
[
"acf31b7fb59fe97f"
]
]
},
{
"id": "5ff49914493234d2",
"type": "delay",
"z": "e4d14b7b7c8cb544",
"name": "",
"pauseType": "delay",
"timeout": "10",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"allowrate": false,
"outputs": 1,
"x": 420,
"y": 1020,
"wires": [
[
"1d9d3814d8779b96"
]
]
},
{
"id": "1d9d3814d8779b96",
"type": "function",
"z": "e4d14b7b7c8cb544",
"name": "",
"func": "\nvar now = new Date();\nvar strtimestamp=Date.parse(new Date())/1000;\n\nvar cameraid="123123"\nmsg.payload = {\n "data": {\n "filename":"/config/www/camera/"+cameraid+".jpg",\n "entity_id":cameraid\n }\n }\n \nreturn msg;\n\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 550,
"y": 1020,
"wires": [
[
"9907525ec25e1d69"
]
]
},
{
"id": "19db7adb9ff0d406",
"type": "function",
"z": "e4d14b7b7c8cb544",
"name": "",
"func": "\nvar picname="123123"\nvar msg1= {};\nmsg1.payload=msg.payload\nreturn msg1;\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 850,
"y": 1020,
"wires": [
[
"6f451de21e173967"
]
]
},
{
"id": "6f451de21e173967",
"type": "http request",
"z": "e4d14b7b7c8cb544",
"name": "获得图片地址",
"method": "GET",
"ret": "bin",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 140,
"y": 1080,
"wires": [
[
"5247a4a161725962",
"c2712c1afc40724a"
]
]
},
{
"id": "5247a4a161725962",
"type": "image",
"z": "e4d14b7b7c8cb544",
"name": "",
"width": "600",
"data": "payload",
"dataType": "msg",
"thumbnail": false,
"active": false,
"pass": false,
"outputs": 0,
"x": 140,
"y": 1120,
"wires": []
},
{
"id": "c2712c1afc40724a",
"type": "base64",
"z": "e4d14b7b7c8cb544",
"name": "获取图片",
"action": "",
"property": "payload",
"x": 360,
"y": 1100,
"wires": [
[
"f9be3cc58037aa23"
]
]
},
{
"id": "f9be3cc58037aa23",
"type": "change",
"z": "e4d14b7b7c8cb544",
"name": "修改",
"rules": [
{
"t": "set",
"p": "image",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 510,
"y": 1100,
"wires": [
[
"1d7755af6e6141db"
]
]
},
{
"id": "1d7755af6e6141db",
"type": "function",
"z": "e4d14b7b7c8cb544",
"name": "图像识别",
"func": "var key=flow.get('looknumber')\n\nvar newMsg = {\n "headers": {\n "Content-Type" : "application/x-www-form-urlencoded"\n },\n "payload": {\n "access_token": key,\n "image": msg.image\n }\n}\nreturn newMsg",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 640,
"y": 1100,
"wires": [
[
"68d3faf42e7aa4ca",
"79b6dbb63bbcb73b"
]
]
},
{
"id": "68d3faf42e7aa4ca",
"type": "http request",
"z": "e4d14b7b7c8cb544",
"name": "API",
"method": "POST",
"ret": "obj",
"paytoqs": "query",
"url": "https://aip.baidubce.com/rest/2.0/ocr/v1/numbers",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 770,
"y": 1100,
"wires": [
[
"c3db3fc1ca6d7fb5",
"c954081ef4ead63e"
]
]
},
{
"id": "79b6dbb63bbcb73b",
"type": "api-call-service",
"z": "e4d14b7b7c8cb544",
"name": "",
"server": "43f262e223290729",
"version": 5,
"debugenabled": false,
"domain": "light",
"service": "turn_off",
"areaId": [],
"deviceId": [],
"entityId": [
"light.044_esp32_cam_light"
],
"data": "",
"dataType": "jsonata",
"mergeContext": "",
"mustacheAltTags": false,
"outputProperties": [],
"queue": "none",
"x": 750,
"y": 1160,
"wires": [
[]
]
},
{
"id": "c3db3fc1ca6d7fb5",
"type": "function",
"z": "e4d14b7b7c8cb544",
"name": "识别结果",
"func": "\nvar msg1={};\nvar laststate=global.get('homeassistant').homeAssistant_synology.states["sensor.gas_reading"].state;\nif(msg.statusCode==200) \n{\n var getstring= msg.payload.words_result[0].words\n var datelength=getstring.substring(0, 6).length\n var result = Number(getstring.substring(0, 6))/10; \n node.status({text: '识别成功:'+JSON.stringify(result), fill: 'green'})\n\n \n \n //var flag=result.substring(0, 2); \n var charge=result-laststate;\n if (datelength==6 && charge>=0 && charge<20 )\n {\n msg1.payload=result\n msg1.topic="sensor/gas_reading/sta/state"\n return msg1;\n } \n}\nelse{\n node.status({text: '登录失败:'+ msg.payload.error_description, fill: 'red'})\n}\n\n",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 900,
"y": 1100,
"wires": [
[
"a49cc7e77f82d24a",
"d0ff985002e6b574"
]
]
},
{
"id": "c954081ef4ead63e",
"type": "debug",
"z": "e4d14b7b7c8cb544",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 890,
"y": 1160,
"wires": []
},
{
"id": "a49cc7e77f82d24a",
"type": "debug",
"z": "e4d14b7b7c8cb544",
"name": "debug 19",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": true,
"complete": "true",
"targetType": "full",
"statusVal": "payload",
"statusType": "auto",
"x": 960,
"y": 1260,
"wires": []
},
{
"id": "d0ff985002e6b574",
"type": "mqtt out",
"z": "e4d14b7b7c8cb544",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "f979baf50ef69816",
"x": 1010,
"y": 1040,
"wires": []
},
{
"id": "43f262e223290729",
"type": "server",
"name": "Home Assistant_synology",
"version": 5,
"addon": false,
"rejectUnauthorizedCerts": true,
"ha_boolean": "y|yes|true|on|home|open",
"connectionDelay": true,
"cacheJson": true,
"heartbeat": false,
"heartbeatInterval": "30",
"areaSelector": "friendlyName",
"deviceSelector": "friendlyName",
"entitySelector": "friendlyName",
"statusSeparator": "at: ",
"statusYear": "hidden",
"statusMonth": "short",
"statusDay": "numeric",
"statusHourCycle": "h23",
"statusTimeFormat": "h:m",
"enableGlobalContextStore": true
},
{
"id": "f979baf50ef69816",
"type": "mqtt-broker",
"name": "MQTT_188",
"broker": "192.168.1.188",
"port": "1883",
"clientid": "NodeRed",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"sessionExpiry": ""
}
]