Hello all,
I have a flow and in this flow a can save numbers in a sql database. I want te replace the numbers in the flow to dynamic numbers from sensor. I think a need tot do this with an array.
I've tried different ways but it doesn't work. Is there anyone who wants to indicate how I can achieve this, or perhaps has an example?
Thanks in advance,
Peter
[{"id":"8b4e6a14e81f8a68","type":"tab","label":"invoer in database","disabled":false,"info":"","env":[]},{"id":"39a046a3a92a5c7f","type":"inject","z":"8b4e6a14e81f8a68","name":"Go","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"400","payloadType":"num","x":150,"y":125,"wires":[["6c2cdc1a2e01b7f3"]]},{"id":"6c2cdc1a2e01b7f3","type":"function","z":"8b4e6a14e81f8a68","name":"INSERT gas","func":"msg.topic = \"INSERT INTO meterstanden (gas) VALUES (300)\";\nmsg.payload = [300];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":345,"y":100,"wires":[["3c11cc576ec8a049"]]},{"id":"1e7bc0f02695eb01","type":"debug","z":"8b4e6a14e81f8a68","name":"","active":true,"console":"false","complete":"false","x":830,"y":150,"wires":[]},{"id":"3c11cc576ec8a049","type":"mysql","z":"8b4e6a14e81f8a68","mydb":"a351da32cbcc0b60","name":"","x":630,"y":150,"wires":[["1e7bc0f02695eb01"]]},{"id":"57068c50e1424f0c","type":"inject","z":"8b4e6a14e81f8a68","name":"Go","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"400","payloadType":"num","x":150,"y":175,"wires":[["7c03990938557fdd","766622559d9a88ab"]]},{"id":"7c03990938557fdd","type":"function","z":"8b4e6a14e81f8a68","name":"INSERT gas","func":"msg.topic = \"INSERT INTO meterstanden (gas) VALUES (555)\";\nmsg.payload = [350];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":345,"y":150,"wires":[["3c11cc576ec8a049"]]},{"id":"766622559d9a88ab","type":"function","z":"8b4e6a14e81f8a68","name":"SELECT Bind","func":"msg.topic = \"SELECT * FROM meterstanden \";\nmsg.payload = [msg.payload];\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":345,"y":200,"wires":[["3c11cc576ec8a049"]]},{"id":"dcc3256d0ce552f5","type":"inject","z":"8b4e6a14e81f8a68","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":225,"wires":[["766622559d9a88ab"]]},{"id":"e8e5b1e52ef8e6a6","type":"inject","z":"8b4e6a14e81f8a68","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"name\":\"John\",\"age\":30}","payloadType":"json","x":400,"y":250,"wires":[["3c11cc576ec8a049"]]},{"id":"99301d0f9b754bc5","type":"debug","z":"8b4e6a14e81f8a68","name":"","active":true,"console":"false","complete":"false","x":745,"y":475,"wires":[]},{"id":"f6bc45f84d3ec7b5","type":"mysql","z":"8b4e6a14e81f8a68","mydb":"a351da32cbcc0b60","name":"","x":555,"y":475,"wires":[["99301d0f9b754bc5"]]},{"id":"9b2fa9e4f573e509","type":"function","z":"8b4e6a14e81f8a68","name":"function 16","func":"msg.topic = \"INSERT INTO meterstanden (gas,dal) VALUES (300,200)\";\nmsg.payload = [300,500];\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":355,"y":475,"wires":[["f6bc45f84d3ec7b5"]]},{"id":"cb79abc2378959cf","type":"inject","z":"8b4e6a14e81f8a68","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":185,"y":475,"wires":[["9b2fa9e4f573e509"]]},{"id":"a351da32cbcc0b60","type":"MySQLdatabase","name":"Homeassistant ","host":"core-mariadb","port":"3306","db":"homeassistant","tz":"","charset":"UTF8"}]