Http in receive a post

Hi

I need to receive data from a datalogger, it post the data every 15min.
But how do i set this up in NodeRED.

Do I need to install a webserver or can i use port 1880 ?

I also did try to make a test to see if it works, but i cant get it working

node red

[{"id":"809c6e4af24655b1","type":"tab","label":"Http in from ATK3","disabled":false,"info":""},{"id":"160ea475ba39bb74","type":"http in","z":"809c6e4af24655b1","name":"","url":"/post_data","method":"post","upload":true,"swaggerDoc":"","x":290,"y":180,"wires":[["4725c1881252c090"]]},{"id":"4725c1881252c090","type":"debug","z":"809c6e4af24655b1","name":"Input from /post_data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":180,"wires":[]},{"id":"5a23c204f4749839","type":"inject","z":"809c6e4af24655b1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":340,"wires":[["17dab0a5f7d8c1e3"]]},{"id":"17dab0a5f7d8c1e3","type":"http request","z":"809c6e4af24655b1","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"/post_data","tls":"","persist":false,"proxy":"","authType":"","x":710,"y":340,"wires":[["86a399a274601254"]]},{"id":"86a399a274601254","type":"debug","z":"809c6e4af24655b1","name":"Test message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":340,"wires":[]}]

No

yes

you need to have a http in and a http response to make a callable endpoint.

see http endpoints in the cookbook: Node-RED Cookbook : Node-RED

Hi

Could this work?

[{"id":"809c6e4af24655b1","type":"tab","label":"Http in from ATK3","disabled":false,"info":""},{"id":"4725c1881252c090","type":"debug","z":"809c6e4af24655b1","name":"Input from /post_data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":820,"y":80,"wires":[]},{"id":"5a23c204f4749839","type":"inject","z":"809c6e4af24655b1","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":310,"y":340,"wires":[["17dab0a5f7d8c1e3"]]},{"id":"17dab0a5f7d8c1e3","type":"http request","z":"809c6e4af24655b1","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"/post_data","tls":"","persist":false,"proxy":"","authType":"","x":710,"y":340,"wires":[["86a399a274601254"]]},{"id":"86a399a274601254","type":"debug","z":"809c6e4af24655b1","name":"Test message","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1050,"y":340,"wires":[]},{"id":"0cb50556d32733f4","type":"comment","z":"809c6e4af24655b1","name":"Test to post something","info":"","x":330,"y":280,"wires":[]},{"id":"8d9c24833c6bcb1f","type":"comment","z":"809c6e4af24655b1","name":"Receive a post from my datalogger","info":"","x":360,"y":120,"wires":[]},{"id":"3e1c5107.c1e3ae","type":"http in","z":"809c6e4af24655b1","name":"","url":"/post_data","method":"post","upload":false,"swaggerDoc":"","x":380,"y":180,"wires":[["cf679478.309868","4725c1881252c090"]]},{"id":"cf679478.309868","type":"template","z":"809c6e4af24655b1","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head></head>\n    <body>\n        <h1>OK</h1>\n    </body>\n</html>","x":630,"y":180,"wires":[["f3c1a3f0.0c3e6","4725c1881252c090"]]},{"id":"f3c1a3f0.0c3e6","type":"http response","z":"809c6e4af24655b1","name":"","statusCode":"","headers":{},"x":810,"y":180,"wires":[]}]

How do I get the data from my logger?

1 Like

No idea, you havent said what kind of logger, not provided any links or documentation.

Looking at your 1st screen shot, the logger will call your endpoint (every 15m) - and will likely pass in the data (probably in msg.payload) - use the debug node to identify where the data comes in.

Once you see data come in, you can then figure out what to do with it.

is it JSON data? CSV Data? What do you want to do with this data? etc etc

PS, the HTTP request is not necessary - that is for calling an endpoint.

I haven't used the http node before.
but i did recevice data on my old server, and here I received this

https://meterreadings.keepfocus.dk/electrocom/post_data?data=11848423&time=2070/
01/01,00:00:55&status=08&d00=1123517!36E@36850!36E@1060317!36E@39878!36E@11154!3
6E@204031!36E@5898984!36E@0!36E:11848423&d01=4B895026!404:00505912&d02=4A9D7CF4!
404:00507901&d03=4A42B8C8!404@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F:00
039887&d04=482BFF00!404@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F:00039890
&d05=4897E1E0!404@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F:00039889&d06=4
AFA449E!404@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F@0!37F:00258271&tz=0&fw=1.3
.938&ip=192.168.112.200

but it seams that I dont get any data in to node red

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.