Writing HTTP request values to InfluxDB

@HaVi
Julian already told you to look into the influxdb log - you can see there in detail whats going on (if not, you have to adjust the log level in the config).

Thanks Walter, I know Julian asked for it but I cannot locate any logfile on my RPi installation. After spending many frustrating hours, I have to conclude that my knowledge of this matter falls short to continue with this project so I quit.

Hey, not so quick! :smile:

sudo journalctl -u influxdb -e -f -n 50

Will show you your InfluxDB logs assuming you installed in in a normal way.

Thanks Julian and after taking a deep breath...

Below my flow so far, the output (value 6.03) in the debug is correct. As far as I know I have to write a measurement to the database and I suppose I need to do some conversion: value -> measurement. If it can be done right from the http-request node that would be nice. The database should contain only the InfuxDB generated timestamp and the value from the flow. This should not be rocket science for many others but for me it is :wink:

With your help I can now show the InfluxDB log but I think we don't need it as long as the flow generates the reported error. Am I right? Otherwise I can publish it here.

[{"id":"810b338d.3f2a9","type":"tab","label":"Julian","disabled":false,"info":""},{"id":"3d4ce47e.b06a9c","type":"debug","z":"810b338d.3f2a9","name":"Output Rhenen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"rhenen","x":900,"y":60,"wires":[]},{"id":"d416eed8.029a3","type":"inject","z":"810b338d.3f2a9","name":"240'","topic":"","payload":"","payloadType":"date","repeat":"14400","crontab":"","once":true,"onceDelay":0.1,"x":230,"y":100,"wires":[["f685ec3f.c89e2"]]},{"id":"f685ec3f.c89e2","type":"http request","z":"810b338d.3f2a9","name":"HTTP Request Rhenen","method":"GET","ret":"obj","url":"https://waterinfo.rws.nl/api/detail?expertParameter=Waterhoogte___20Oppervlaktewater___20t.o.v.___20Normaal___20Amsterdams___20Peil___20in___20cm&locationSlug=Grebbe%28GREB%29&user=publiek","tls":"","x":430,"y":100,"wires":[["e9a1c396.7bfe5"]]},{"id":"e9a1c396.7bfe5","type":"function","z":"810b338d.3f2a9","name":"Function Rhenen","func":"msg.rhenen = Number(msg.payload.latest.data)/100;\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":100,"wires":[["3d4ce47e.b06a9c","b2e942c4.d7e9b"]]},{"id":"b2e942c4.d7e9b","type":"influxdb out","z":"810b338d.3f2a9","influxdb":"18285695.aa63d9","name":"","measurement":"rhenen","precision":"","retentionPolicy":"","x":910,"y":140,"wires":[]},{"id":"18285695.aa63d9","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"Test (local)","usetls":false,"tls":""}]

You are trying to insert the output of the html request. Read my comment above, change lux:lux into waterstand:waterstand ( or something) and measurement as well, connect it to a batch node and it works.

1 Like

You mean like this?

Thanks both for helping and waking me up, it's working now! For those who are interested the flow below.

[{"id":"eb4a51fd.b1152","type":"tab","label":"Bakman","disabled":false,"info":""},{"id":"dd29d774.22daa8","type":"debug","z":"eb4a51fd.b1152","name":"Output Rhenen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0].fields.rhenen","x":940,"y":60,"wires":[]},{"id":"42668027.172af","type":"inject","z":"eb4a51fd.b1152","name":"240'","topic":"","payload":"","payloadType":"date","repeat":"14400","crontab":"","once":true,"onceDelay":0.1,"x":230,"y":100,"wires":[["3928bb4d.961e94"]]},{"id":"3928bb4d.961e94","type":"http request","z":"eb4a51fd.b1152","name":"HTTP Request Rhenen","method":"GET","ret":"obj","url":"https://waterinfo.rws.nl/api/detail?expertParameter=Waterhoogte___20Oppervlaktewater___20t.o.v.___20Normaal___20Amsterdams___20Peil___20in___20cm&locationSlug=Grebbe%28GREB%29&user=publiek","tls":"","x":430,"y":100,"wires":[["5e8a4a4c.2a0ec4"]]},{"id":"5e8a4a4c.2a0ec4","type":"function","z":"eb4a51fd.b1152","name":"Function Rhenen","func":"rhenen = msg.payload.latest.data\n\nmsg.payload = [\n    {\n        measurement:\"test\",\n        fields: {\n           rhenen:rhenen\n        },\n    }];\n\nreturn msg","outputs":1,"noerr":0,"x":670,"y":100,"wires":[["dd29d774.22daa8","aaa75e74.29b8a"]]},{"id":"aaa75e74.29b8a","type":"influxdb batch","z":"eb4a51fd.b1152","influxdb":"18285695.aa63d9","precision":"","retentionPolicy":"","name":"","x":930,"y":120,"wires":[]},{"id":"18285695.aa63d9","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"Test (local)","usetls":false,"tls":""}]
3 Likes

Never give up :wink:

Next step: grafana! :sweat_smile:

2 Likes

Indeed, never give up and patience... Grafana works perfect allready!