边学边玩:万物在线nodered流分享v0.1。

致谢

感谢flashsoft发的nr流;

感谢花神的nodered节点;

感谢dodoJie、萝卜、鬼鬼等大佬以及所有坛友的热心帮助。

截图

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,流程里面function相关的内容都是dodoJie和萝卜大佬耐心指导、手把手教的,很惭愧,看了好些例子,等到自己操作的时候还是无从下爪,要学的很多,路漫漫而修远,争取早日进入NR自动化的世界。

这里太冷清了 加油

说实话,我倒觉得挺好的。我喜欢清静,/认真脸。

我觉得是不是应该补充下所需外物啥的,我只看到了流程教学,但是不知道改用什么东西玩:lol

这个流还有好多问题,我得慢慢的改啊,先去大坛子里面看看吧,嘿嘿。