2022-02-10 貌似很多人反应万物不能用了,因为我已经至少1年半没有再用这个了(模块早都被娃弄丢了),所以抱歉啦,我也没有发言权,毕竟好几年了,谢谢关注本帖。
相关更新说明
2190519,根据萝卜大佬的流程增加了逆地理(同时参考了令狐大佬的逆地理转换方法),yaml增加了重启HA自动触发执行流程的自动化(来自彩云天气的nodered流程),整理了一下,附件我重新打包上传了。
逆地理效果图:
墨澜显示地图效果:
sensor信息我都提取出来了,其实也没什么用,有些数据没什么意义,可以自己转换成顺眼的,时间戳这个等F大和花神他们的节点更新。
新的附件:
gps_flow.rar
(2.37 KB, 下载次数: 259)
nodered_gps.rar
(1.2 KB, 下载次数: 241)
20190518,20:05 大佬发了个新的流给我,应该很全了,逆地理貌似也做了,我明天看看再更新一下,我先放附件里面了。
20190518,20:00 补充完毕。
以下是原帖内容
提示
因为我的模块本身不是汽车在线平台,都是万物在线的,不过萝卜大佬说都一样,所以不同的平台安装对应的节点就行了,见教程部分。
致谢
感谢flashsoft发的nr流;
感谢花神的nodered节点;
感谢dodoJie、萝卜、鬼鬼等大佬以及所有坛友的热心帮助。
功能
利用花神做好的nodered节点,通过这个流程将万物在线GPS模块信息接入HA,实现设备信息查看和地图的device_tracker追踪。
流程截图
flow
[{"id":"d688cd16.ab96f","type":"tab","label":"万物在线节点","disabled":false,"info":""},{"id":"3dd1d8eb.13b2e8","type":"gmiot-login","z":"d688cd16.ab96f","server":"723ec47c.76332c","name":"万物在线登陆","x":353,"y":149,"wires":[["c56779f0.bd8db8"],[]]},{"id":"cafb3195.3549b","type":"gmiot-monitor","z":"d688cd16.ab96f","server":"723ec47c.76332c","name":"设备监控","x":317,"y":407,"wires":[["e0ef8ec2.79887","9d06bce8.c3929","1243aa1a.76ef76","3ba20060.a7433","15e74504.26ab2b","c35c88e4.cd61f8","4c5a3a4c.c959f4"],[]]},{"id":"cf6762fd.ef343","type":"mqtt out","z":"d688cd16.ab96f","name":"GPS1数据","topic":"node-red/gmiot/gps1","qos":"0","retain":"false","broker":"90976202.aa203","x":728,"y":329,"wires":[]},{"id":"bc4274ec.351f28","type":"inject","z":"d688cd16.ab96f","name":"手动触发","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":158,"y":118,"wires":[["3dd1d8eb.13b2e8"]]},{"id":"e0ef8ec2.79887","type":"debug","z":"d688cd16.ab96f","name":"设备日志","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":520,"y":260,"wires":[]},{"id":"9d06bce8.c3929","type":"function","z":"d688cd16.ab96f","name":"GPS1数据取值","func":"var newMsg = \n\n{payload:msg.payload.dataArray.data[0]};\n\nreturn newMsg ;","outputs":1,"noerr":0,"x":540,"y":329,"wires":[["cf6762fd.ef343"]]},{"id":"603473ae.e1b6dc","type":"inject","z":"d688cd16.ab96f","name":"定时2小时","topic":"","payload":"","payloadType":"date","repeat":"7200","crontab":"","once":false,"onceDelay":0.1,"x":148,"y":178,"wires":[["3dd1d8eb.13b2e8"]]},{"id":"1243aa1a.76ef76","type":"function","z":"d688cd16.ab96f","name":"GPS2数据取值","func":"\nvar newMsg = \n\n{payload:msg.payload.dataArray.data[1]};\n\nreturn newMsg ;","outputs":1,"noerr":0,"x":540,"y":400,"wires":[["757bd89a.65bb58"]]},{"id":"757bd89a.65bb58","type":"mqtt out","z":"d688cd16.ab96f","name":"GPS2数据","topic":"node-red/gmiot/gps2","qos":"0","retain":"false","broker":"90976202.aa203","x":727,"y":400,"wires":[]},{"id":"3ba20060.a7433","type":"function","z":"d688cd16.ab96f","name":"GPS3数据取值","func":"var newMsg = {payload:msg.payload.dataArray.data[2]};\nreturn newMsg ;","outputs":1,"noerr":0,"x":540,"y":460,"wires":[["2038b6af.10bc9a"]]},{"id":"c56779f0.bd8db8","type":"debug","z":"d688cd16.ab96f","name":"token日志","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":540,"y":143,"wires":[]},{"id":"2038b6af.10bc9a","type":"mqtt out","z":"d688cd16.ab96f","name":"GPS3数据","topic":"node-red/gmiot/gps3","qos":"0","retain":"false","broker":"90976202.aa203","x":730,"y":460,"wires":[]},{"id":"15e74504.26ab2b","type":"function","z":"d688cd16.ab96f","name":"GPS1坐标取值","func":"msg.payload = {\n\"source_type\":msg.payload.dataArray.data[0].location,\n\"longitude\":msg.payload.dataArray.data[0].lng,\n\"latitude\":msg.payload.dataArray.data[0].lat,\n\"gps_accuracy\":msg.payload.dataArray.data[0].course,\n\"speed\":msg.payload.dataArray.data[0].speed,\n\"timestamp\":msg.payload.dataArray.data[0].heart_time,\n\"battery_level\":msg.payload.dataArray.data[0].power,};\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":520,"wires":[["b2a275f9.e4e618"]]},{"id":"b2a275f9.e4e618","type":"json","z":"d688cd16.ab96f","name":"数据处理1","property":"payload","action":"","pretty":false,"x":730,"y":520,"wires":[["6e68bd92.ed5504"]]},{"id":"6e68bd92.ed5504","type":"mqtt out","z":"d688cd16.ab96f","name":"GPS1定位","topic":"locaton/gps1","qos":"0","retain":"false","broker":"90976202.aa203","x":910,"y":520,"wires":[]},{"id":"3aaafae6.88cb96","type":"mqtt in","z":"d688cd16.ab96f","name":"HA启动触发","topic":"node-red/homeassistant-setup","qos":"2","datatype":"auto","broker":"90976202.aa203","x":116,"y":467,"wires":[["cafb3195.3549b"]]},{"id":"1b33d8ab.01a007","type":"inject","z":"d688cd16.ab96f","name":"手动触发","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":126,"y":347,"wires":[["cafb3195.3549b"]]},{"id":"590b4f31.38d64","type":"inject","z":"d688cd16.ab96f","name":"定时2分钟","topic":"","payload":"","payloadType":"date","repeat":"120","crontab":"","once":false,"onceDelay":0.1,"x":115,"y":407,"wires":[["cafb3195.3549b"]]},{"id":"3568e6d3.7e66da","type":"json","z":"d688cd16.ab96f","name":"数据处理2","property":"payload","action":"","pretty":false,"x":730,"y":580,"wires":[["847c69d9.213f18"]]},{"id":"847c69d9.213f18","type":"mqtt out","z":"d688cd16.ab96f","name":"GPS2定位","topic":"locaton/gps2","qos":"0","retain":"false","broker":"90976202.aa203","x":910,"y":580,"wires":[]},{"id":"c35c88e4.cd61f8","type":"function","z":"d688cd16.ab96f","name":"GPS2坐标取值","func":"msg.payload = {\n\"source_type\":msg.payload.dataArray.data[1].location,\n\"longitude\":msg.payload.dataArray.data[1].lng,\n\"latitude\":msg.payload.dataArray.data[1].lat,\n\"gps_accuracy\":msg.payload.dataArray.data[1].course,\n\"speed\":msg.payload.dataArray.data[1].speed,\n\"timestamp\":msg.payload.dataArray.data[1].heart_time,\n\"battery_level\":msg.payload.dataArray.data[1].power,};\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":580,"wires":[["3568e6d3.7e66da"]]},{"id":"54abb627.c23db8","type":"json","z":"d688cd16.ab96f","name":"数据处理3","property":"payload","action":"","pretty":false,"x":730,"y":640,"wires":[["3efb6352.d9318c"]]},{"id":"3efb6352.d9318c","type":"mqtt out","z":"d688cd16.ab96f","name":"GPS3定位","topic":"locaton/gps3","qos":"0","retain":"false","broker":"90976202.aa203","x":910,"y":640,"wires":[]},{"id":"4c5a3a4c.c959f4","type":"function","z":"d688cd16.ab96f","name":"GPS2坐标取值","func":"msg.payload = {\n\"source_type\":msg.payload.dataArray.data[2].location,\n\"longitude\":msg.payload.dataArray.data[2].lng,\n\"latitude\":msg.payload.dataArray.data[2].lat,\n\"gps_accuracy\":msg.payload.dataArray.data[2].course,\n\"speed\":msg.payload.dataArray.data[2].speed,\n\"timestamp\":msg.payload.dataArray.data[2].heart_time,\n\"battery_level\":msg.payload.dataArray.data[2].power,};\nreturn msg;","outputs":1,"noerr":0,"x":540,"y":640,"wires":[["54abb627.c23db8"]]},{"id":"723ec47c.76332c","type":"gmiot-configurator","z":"","name":"万物账号","phone":"xxx","password":"xxx"},{"id":"90976202.aa203","type":"mqtt-broker","z":"","name":"hassio-mqtt","broker":"10.16.100.35","port":"1883","clientid":"nodered-client","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]
前提
安装了nodered,并配置好了HA的节点;
安装了mqtt,在NR中配置好了mqtt节点。
用法
1、安装花神的Nodered节点;
万物在线用这个:
node-red-contrib-gps-lite-gmiot
汽车在线用这个:
node-red-contrib-gps
2、导入flow;
3、将附件的yaml放进packages文件夹下,device_tracker和sensor相关的配置、汉化、图标等我都做好了。
4、重启HA
5、配置lovelace,因为没用group,附件放个单独的sensor明细。
6、配置地图相关
我用的论坛里大佬做的高德的lovelace插件,其他的没测试。
地图插件地址:https://bbs.hassbian.com/thread-5782-1-1.html,
这个也有偏移,不过都在偏,除了看起来别扭,先将就吧。
后话
模块的sensor里面,时间戳暂时没做转换(还不会),花神可能会更新节点直接写好,HA里面转换也是可以的,得自己动手了,我暂时不想搞了。
这个流我就做了一些和HA相关的基础工作,流程用到的处理方式都是萝卜大佬和dodoJie大佬帮忙写的,最近大佬们都比较忙,我拼凑了一下,先帮忙发出来给需要的坛友,流程本身有很多优化的空间,萝卜大佬可能会出一个新流,我也是边学边玩,就这样吧。
enjoy !
如果有疑问的话,可以留言,我看到而且知道的话会回复,但是强烈建议在搜索论坛帖子学习。
附件:
flows.rar
(1.61 KB, 下载次数: 90)
groups.rar
(249 Bytes, 下载次数: 105)
nodered_gps.rar
(1.44 KB, 下载次数: 94)
萝卜新的flow附件:
萝卜大佬万物流.rar
(541 Bytes, 下载次数: 154)