『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: hunterfox

[技术探讨] Esp-32cam 【含流代码】图像识别接入燃气数据 百度数字识别

[复制链接]

4

主题

16

帖子

137

积分

注册会员

Rank: 2

积分
137
金钱
121
HASS币
0
发表于 2024-1-9 11:20:46 | 显示全部楼层
大佬牛哇。很不错的创意
回复

使用道具 举报

3

主题

86

帖子

712

积分

高级会员

Rank: 4

积分
712
金钱
626
HASS币
0
发表于 2024-1-9 11:28:08 | 显示全部楼层
家里刚好有个32CAM 想要nodered流
回复

使用道具 举报

43

主题

412

帖子

3806

积分

元老级技术达人

积分
3806
金钱
3389
HASS币
136
 楼主| 发表于 2024-1-9 20:08:20 | 显示全部楼层
sandra602 发表于 2024-1-9 11:28
家里刚好有个32CAM 想要nodered流

有了
回复

使用道具 举报

43

主题

412

帖子

3806

积分

元老级技术达人

积分
3806
金钱
3389
HASS币
136
 楼主| 发表于 2024-1-9 20:08:45 | 显示全部楼层
lsxxzcc 发表于 2024-1-2 09:04
node-red流程粘贴分享学习下

有了
回复

使用道具 举报

51

主题

1339

帖子

5596

积分

论坛DIY达人

积分
5596
金钱
4257
HASS币
20
发表于 2024-1-9 20:18:28 | 显示全部楼层
不错!要是纯本地的话就好玩了
回复

使用道具 举报

4

主题

166

帖子

1280

积分

金牌会员

Rank: 6Rank: 6

积分
1280
金钱
1114
HASS币
0
发表于 2024-1-9 21:01:53 | 显示全部楼层
成本怎么样啊
回复

使用道具 举报

3

主题

86

帖子

712

积分

高级会员

Rank: 4

积分
712
金钱
626
HASS币
0
发表于 2024-1-10 14:50:17 | 显示全部楼层
回复

使用道具 举报

4

主题

76

帖子

563

积分

高级会员

Rank: 4

积分
563
金钱
487
HASS币
0
发表于 2024-1-10 16:20:49 | 显示全部楼层
哥,json导不进去
回复

使用道具 举报

4

主题

76

帖子

563

积分

高级会员

Rank: 4

积分
563
金钱
487
HASS币
0
发表于 2024-1-10 16:23:43 | 显示全部楼层
cr130 发表于 2024-1-10 16:20
哥,json导不进去
[
    {
        "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": ""
    }
]
回复

使用道具 举报

3

主题

171

帖子

1929

积分

金牌会员

Rank: 6Rank: 6

积分
1929
金钱
1758
HASS币
0
发表于 2024-1-10 18:26:06 | 显示全部楼层
导入报错 是我就这样吗
2024-1-10 18-25-47.png
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-23 21:12 , Processed in 0.064094 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表