HTTP-in get Request

hi

I would like to solve a data application with http:/ (it is a little bit new land for me)

with NodeRed I could solve our irrigation system fully automatically (Raspi PI as CPU and 3 ESP8266 for the control of Pump an 7 valves) it works very nice

at now I have build-up a weather-station with 7 sensors, Arduino system and connected to the weathercloud

(see https://app.weathercloud.net/d5888355814#evolution)

the WeatherStation is a dhcp client with fix ip-address in my network. the data sends with a call

client.connect(server , 80);

http://api.weathercloud.net

client.print("GET /set/wid/…….…/key/……..…“);

client.print(“/item/“); client.print(value);

….

….

all of totally 13 data values

now my idea:

server_2 ist the Raspi PI with NR (ip 192.168.1.101)

client.connect (server_2, 80)

to fetch all “client.print(…)“ for showing all value on the dashboard and may store in mySQL

but now I’m missing the „kick off“ to find the way provide this http-request

There are examples of http requests in the cookbook. https://cookbook.nodered.org/#http-requests

thank you for your response

I have consult and trying and playing with this mentioned examples, but the client will not respond
I can not find out, witch message I have to send for get data...

You should always get some kind of a response, if only an error from the client. Make sure that you attach a debug node immediately after the request node and set it to output the whole msg not just the payload.

Can I check I understand what you are trying to do. Are you trying to perform an http request from node red on a pi, to http://api.weathercloud.net?
When you say the client will not respond do you mean weathercloud does not respond? If so then weathercloud is the server, node-red is the client.

no, the station it self is sending data autonomy to the weatherclaud, this is ok

Furthermore I want to have the same data on my own central (the Raspi with NodeRed)

On the weatherstation (Arduino) I can define the second server, the Raspi with NR

The weatherclaud takes new data every 10 minutes, this is still working

directly I can get data every 5 seconds, but I don’t know, how I can call the client, the weatherstation from the NR, so that I get the data in the same way, as to the weaterclaud (http:/)

in the debug I get te message:
Error, [http request:...... ] no response from the server
(complete msg object)

If you're trying to push data to an http in node, be sure you're either using the port NR is running (default 1880) on as the outbound port on your sensor, or that you're NATting whatever your sensor sends on to that port.

So do you mean the Arduino will be sending data to node-red using the same protocol as it uses to send data to weathercloud? Can you point us to a definition of the API so we can see it? From your first post you seem to be suggesting that the Arduino will execute a Get request on node-red. Can you show us how you have configured the http node in node-red?
What url are you telling the Arduino to use?

Just looked at this post again. That suggests that you are using an http request node, which will send an http request to the Arduino, but I thought you said the Arduino is sending the request to node-red.

Hi

thank you all for your assistance

Port 80 was Arduino, of course NR is Port 1880
the API is still not defined an is my problem
the url from the Arduino is the fix given IP-address
the Arduino connect and send data independent
the Arduino must execute a PUT request to store data by NR

It is for me a bit confuse, in my last project with the ESP8266's they was "Server" and NR as Client
but now I have find the way and also literature for HTTP and find examples for data transfer too

If the Arduino is posting data to node-red then you need to use an Http In node. That can be configured to expect a PUT to be received.

A further thought, if you are trying to get the same data that are sent to weathercloud into the Pi, can you not get it from weathercloud rather than sending it again from the Arduino? If weathercloud has an api that lets you get your own data back that is.

unfortunately not, because the weathercloud takes new data every 10 minutes only and I like to have fresh data every minutes for indication

That makes sense.