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

 找回密码
 立即注册
123
返回列表 发新帖
楼主: Fable

[经验分享] 【zigbee版】通过脉冲计数读燃气表,将使用量接入HA

[复制链接]

9

主题

98

帖子

705

积分

高级会员

Rank: 4

积分
705
金钱
602
HASS币
30
发表于 2023-2-23 11:49:11 | 显示全部楼层
本帖最后由 neighbour 于 2023-2-23 11:57 编辑
mobility 发表于 2023-2-15 15:02
你好!我的燃气表,没有反光片,无法使用光反射来取数,请问你可以 发些资料给我吗?我也想用 百度的ai识 ...

QQ截图20230223114808.png
我的气表字体特殊。百度识别准确性拫差。如果只识别四位的话会提高准确性





[{"id":"976de61d.0323d8","type":"function","z":"8e99b4b40fc27c69","name":"构造API消息","func":"var a=msg.payload\nvar b=a.replace(\"data:image/jpeg;base64,\",\"\")\nmsg.payload=\"image=\"+b\nvar token=global.get('token')\nmsg.url=\"https://aip.baidubce.com/rest/2.0/ocr/v1/numbers?access_token=\"+token\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":130,"y":1280,"wires":[["a3d0c8ba.5de698"]]},{"id":"a3d0c8ba.5de698","type":"change","z":"8e99b4b40fc27c69","name":"URL转义","rules":[{"t":"change","p":"payload","pt":"msg","from":"/","fromt":"str","to":"%2F","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"+","fromt":"str","to":"%2B","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":1280,"wires":[["948e678a.524f78"]]},{"id":"948e678a.524f78","type":"http request","z":"8e99b4b40fc27c69","name":"","method":"POST","ret":"txt","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{"user":"","password":""},"x":495,"y":1280,"wires":[["aa0e82cd.80e7c"]]},{"id":"aa0e82cd.80e7c","type":"json","z":"8e99b4b40fc27c69","name":"","property":"payload","action":"obj","pretty":false,"x":660,"y":1280,"wires":[["769863bc.1346bc","ae0e95ac446236b8"]]},{"id":"ae0e95ac446236b8","type":"switch","z":"8e99b4b40fc27c69","name":"token失效检测","property":"payload.error_code","propertyType":"msg","rules":[{"t":"cont","v":"110","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":865,"y":1280,"wires":[[]]},{"id":"769863bc.1346bc","type":"change","z":"8e99b4b40fc27c69","name":"提取返回结果","rules":[{"t":"move","p":"payload.words_result.0.words","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":140,"y":1330,"wires":[[]]},{"id":"d18e5c88.c9bfb","type":"simplejs","z":"8e99b4b40fc27c69","g":"3cf66ba9552b45cc","func":"parse-int","property":"payload","name":"转成数值","x":320,"y":1330,"wires":[["a1d0eaac.f40208"]]},{"id":"a1d0eaac.f40208","type":"function","z":"8e99b4b40fc27c69","name":"数值变换清洗","func":"var a=msg.payload\nvar b=a/100\nif (b<5000&&b>4000&&(b-global.get('rqls')<30&&(b-global.get('rqls'))>0))\n{\n    msg.payload=b\n}\nelse\n{\nmsg.payload=global.get('rqls')\n    \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":515,"y":1330,"wires":[["6ba60ff7.3892f"]]},{"id":"6ba60ff7.3892f","type":"function","z":"8e99b4b40fc27c69","name":"数据比较","func":"var a=msg.payload\nvar rqls=global.get('rqls')\nif (a>=rqls)\n{\n    msg.payload=a\n    global.set('rqls',a)\n}\nelse\n{\nmsg.payload=global.get('rqls')\n    \n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":670,"y":1330,"wires":[[]]},{"id":"d13dd6b7.2a4d38","type":"inject","z":"8e99b4b40fc27c69","name":"周末白天","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"0 7-18 * * 6,0","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":130,"y":1080,"wires":[[]]},{"id":"9163a683.d762e8","type":"ONVIF Snapshot","z":"8e99b4b40fc27c69","g":"c63021ea63fed787","name":"燃气抄表","url":"http://192.168.1.219:8080/onvif/device_service","username":"admin","password":"xxxxxxx","x":320,"y":1080,"wires":[["9b78d6e9.3d5018"]]},{"id":"9b78d6e9.3d5018","type":"change","z":"8e99b4b40fc27c69","name":"移动payload","rules":[{"t":"move","p":"payload.image.base64","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":330,"y":1130,"wires":[["89a816f4.e9ebf8"]]},{"id":"89a816f4.e9ebf8","type":"change","z":"8e99b4b40fc27c69","name":"去掉前缀","rules":[{"t":"change","p":"payload","pt":"msg","from":"data:image/jpeg;base64,","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":1130,"wires":[["61f433d4fcee2e95"]]},{"id":"61f433d4fcee2e95","type":"image viewer","z":"8e99b4b40fc27c69","name":"","width":"320","data":"payload","dataType":"msg","active":true,"x":510,"y":1180,"wires":[["9cfbedb1.b6f99"]]},{"id":"9cfbedb1.b6f99","type":"jimp-image","z":"8e99b4b40fc27c69","name":"裁切","data":"payload","dataType":"msg","ret":"b64","parameter1":"390","parameter1Type":"num","parameter2":"370","parameter2Type":"num","parameter3":"800","parameter3Type":"num","parameter4":"160","parameter4Type":"num","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","sendPropertyType":"msg","parameterCount":4,"jimpFunction":"crop","selectedJimpFunction":{"name":"crop","fn":"crop","description":"crop to the given region","parameters":[{"name":"x","type":"num","required":true,"hint":"the x coordinate to crop form"},{"name":"y","type":"num","required":true,"hint":"the y coordinate to crop form"},{"name":"w","type":"num","required":true,"hint":"the width of the crop region"},{"name":"h","type":"num","required":true,"hint":"the height of the crop region"}]},"x":685,"y":1180,"wires":[["91b0ad17.8b417"]]},{"id":"91b0ad17.8b417","type":"jimp-image","z":"8e99b4b40fc27c69","name":"转灰度","data":"payload","dataType":"msg","ret":"b64","parameter1":"0.5","parameter1Type":"msg","parameter2":"","parameter2Type":"num","parameter3":"780","parameter3Type":"num","parameter4":"200","parameter4Type":"Blend","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","sendPropertyType":"msg","parameterCount":0,"jimpFunction":"greyscale","selectedJimpFunction":{"name":"greyscale","fn":"greyscale","description":"remove colour from the image","parameters":[]},"x":860,"y":1180,"wires":[["c3d70deb.132b"]]},{"id":"c3d70deb.132b","type":"image viewer","z":"8e99b4b40fc27c69","name":"","width":"240","data":"payload","dataType":"msg","active":true,"x":1060,"y":1180,"wires":[["ee6d2790.11c3e8"]]},{"id":"ee6d2790.11c3e8","type":"jimp-image","z":"8e99b4b40fc27c69","name":"位图转换","data":"payload","dataType":"msg","ret":"b64","parameter1":"100","parameter1Type":"num","parameter2":"255","parameter2Type":"num","parameter3":"","parameter3Type":"none","parameter4":"180","parameter4Type":"num","parameter5":"","parameter5Type":"msg","parameter6":"","parameter6Type":"msg","parameter7":"","parameter7Type":"msg","parameter8":"","parameter8Type":"msg","sendProperty":"payload","sendPropertyType":"msg","parameterCount":3,"jimpFunction":"threshold","selectedJimpFunction":{"name":"threshold","fn":"threshold","description":"apply one or more functions","parameters":[{"name":"max","group":"options","type":"num","required":true,"hint":"max value of byte 0 ~ 255"},{"name":"replace","group":"options","type":"num","required":false,"hint":"replace with byte 0 ~ 255. Default is 255"},{"name":"autoGreyscale","group":"options","type":"bool","required":false,"hint":"default is true"}]},"x":1275,"y":1180,"wires":[["976de61d.0323d8"]]}]
回复

使用道具 举报

9

主题

98

帖子

705

积分

高级会员

Rank: 4

积分
705
金钱
602
HASS币
30
发表于 2023-3-4 14:20:28 | 显示全部楼层
mobility 发表于 2023-2-15 15:02
你好!我的燃气表,没有反光片,无法使用光反射来取数,请问你可以 发些资料给我吗?我也想用 百度的ai识 ...

刚发现一个便宜 省事的方案
https://jomjol.github.io/AI-on-the-edge-device-docs/Installation/
回复

使用道具 举报

53

主题

288

帖子

1836

积分

金牌会员

Rank: 6Rank: 6

积分
1836
金钱
1548
HASS币
0
发表于 2023-3-6 08:46:11 | 显示全部楼层
本帖最后由 mobility 于 2023-3-8 09:14 编辑

gass.png 谢谢你提供的消息哦,总算是基本搞定了,花的时间最多的是 反复测试如何固定设备,获得最佳效果的照片。。。
回复

使用道具 举报

0

主题

12

帖子

110

积分

注册会员

Rank: 2

积分
110
金钱
98
HASS币
0
发表于 2023-3-25 23:27:21 | 显示全部楼层
插眼,插眼
回复

使用道具 举报

0

主题

35

帖子

132

积分

注册会员

Rank: 2

积分
132
金钱
97
HASS币
0
发表于 2023-7-1 16:03:20 | 显示全部楼层
很好、很强大,这个一定得支持!!!
回复

使用道具 举报

0

主题

19

帖子

58

积分

注册会员

Rank: 2

积分
58
金钱
39
HASS币
0
发表于 2024-7-31 15:50:05 | 显示全部楼层
先学习,感谢分享
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 09:12 , Processed in 0.206751 second(s), 28 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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