2020年8月24日 星期一

Node-Red & MySQL random 2 number Store To MySQL Database

 Node-Red & MySQL random  2 number Store To MySQL Database











[{"id":"6a6300bd.5b3a6","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"e85555cf.03b198","type":"debug","z":"6a6300bd.5b3a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":570,"y":40,"wires":[]},{"id":"7fa0d45f.9028ec","type":"function","z":"6a6300bd.5b3a6","name":"MySQL Function","func":"temperature =  msg.payload[0]\nhumidity = msg.payload[1]\n\n//humidity = msg.payload.humidity\n//temperature = msg.payload.temperature\nmsg.topic = \"INSERT INTO temp_humi ( `temperature`, `humidity`) VALUES ( \"+ temperature+\", \"+ humidity +\");\"\nreturn msg;\n\n","outputs":1,"noerr":0,"x":450,"y":200,"wires":[["bb82ea59.32bd68","db671226.0ba2f"]]},{"id":"bb82ea59.32bd68","type":"mysql","z":"6a6300bd.5b3a6","mydb":"3ec1eff7.3a59c","name":"MySQLDatabase","x":690,"y":200,"wires":[[]]},{"id":"8a986dfc.3816c","type":"inject","z":"6a6300bd.5b3a6","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":80,"y":140,"wires":[["9ed27499.0d9ca8","7740e351.41719c"]]},{"id":"9ed27499.0d9ca8","type":"random","z":"6a6300bd.5b3a6","name":"","low":"-50","high":"50","inte":"true","property":"payload","x":240,"y":120,"wires":[["fd7b9e51.97bab"]]},{"id":"7740e351.41719c","type":"random","z":"6a6300bd.5b3a6","name":"","low":"1","high":"100","inte":"true","property":"payload","x":240,"y":160,"wires":[["fd7b9e51.97bab"]]},{"id":"fd7b9e51.97bab","type":"join","z":"6a6300bd.5b3a6","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":390,"y":120,"wires":[["e85555cf.03b198","7fa0d45f.9028ec"]]},{"id":"db671226.0ba2f","type":"debug","z":"6a6300bd.5b3a6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":660,"y":300,"wires":[]},{"id":"3ec1eff7.3a59c","type":"MySQLdatabase","z":"","name":"","host":"127.0.0.1","port":"3306","db":"mysql_test1","tz":"GMT +8"}]

沒有留言:

張貼留言

2024_09 作業3 以Node-Red 為主

 2024_09 作業3  (以Node-Red 為主  Arduino 可能需要配合修改 ) Arduino 可能需要修改的部分 1)mqtt broker  2) 主題Topic (發行 接收) 3) WIFI ssid , password const char br...