More arduino devices and communication

I have two home projects based on the NodeMCU. One is Webcontrolled relay switch and one is Solar pump switch. Both are with Webpage. But now I'm thinking how to integrate together - all information to one point. I checked a lot of articles regarding IOT and brookers, but for me isn't clear, how communication between each device and central point is working. What is communication protocol and how to modify my arduino project to be able communicate with this central point.

I don't want use a central point somewhere on the internet, but localy in my local home network.

How you solved this cental communication with your arduino devices ?
Thanks
Alda

What do you mean by "Both are with Webpage" ?

If you set up a webserver on a PC on your home network your NodeMCU devices could be programmed to act as clients for that server.

I have found the Python Bottle web framework very easy to use. You can have a very basic server operating in 15 minutes or so and you have all the capabilities that Python offers for saving or manipulating the data that is collected.

...R

Sorry for not clear information. Means that both NodeMCU are connected to the network and each one has own webserver where I can see a results of measurements and can switch on/off relay.

IMHO it would be better to program the NodeMCUs as clients rather than servers and have the server on your PC.

...R

NodeMCU as client and pc as server is ok, but how it works? What is communication protocol and how program NodeMCU?
Thanks

alda2:
NodeMCU as client and pc as server is ok, but how it works? What is communication protocol and how program NodeMCU?

It would take much too long to answer that.

I think the best way to learn about web programming is on a PC rather than an Arduino. There are thousands of tutorials for PC web programming. When you know how to do it on the PC then it will be straightforward to implement on a NodeMCU - just keep things simple.

You could start by setting up the Bottle web server using their basic example and writing a separate short Python web client program that just does a GET request the same as your browser. There will be plenty of tutorials to show how to create a client with Python and it will probably only need a dozen or so lines of code.

Then you could try programming the NodeMCU with an equally short program that is the equivalent of the Python client.

However there are hundreds of ways to learn this stuff if you prefer a different approach.

...R

Thanks. It was Reason why I am asking. For me isn't a problem to program NodeMCU which will answer on any request or will send result data automaticaly, but important for me is, if there is any standart. I found a lot of about iot, brookers, mqtt. Or I must make my own system? Because server must ask client. So he must know on which adress client is, next he must know how to ask..etc. Is client answering json data, which format ? I read a lot of abot it,but now more questions then before.

alda2:
Sorry for not clear information. Means that both NodeMCU are connected to the network and each one has own webserver where I can see a results of measurements and can switch on/off relay.

I don't know the specifics of the NodeMCU, but it is a typical setup for ethernet/wifi boards to run server functions and await data request or action request from clients such as browser web pages and similar. Web pages can have functions where data is display and automatically updated.

Yes, but if I have more devices, webpage must dynamicaly change depends on information from client how many inputs/outputs he has. And how client share this informations? So NodeMCU must somehow tell to server pc "i have two sensors and one relay" and webpage on this pc must show two sensor informations and one action button. And this is a question how to do it.

alda2:
Yes, but if I have more devices, webpage must dynamicaly change depends on information from client how many inputs/outputs he has. And how client share this informations? So NodeMCU must somehow tell to server pc "i have two sensors and one relay" and webpage on this pc must show two sensor informations and one action button. And this is a question how to do it.

It seems to me you are asking that question in a vacuum. Have you taken any of the steps I suggested to gain more knowledge of web programming? I reckon if you had you would also have a fairly good idea how to do the things you are asking about here,

It is common to the point of being normal for web clients and servers to exchange complex data.

...R

at this moment I have web via nodemcu :
usual standart :

WiFi.begin(ssid, password);
//check wi-fi is connected to wi-fi network
while ((WiFi.status() != WL_CONNECTED)){
delay(1000);
}

.
server.on("/VALUES", handle_OnConnect_VALUES);
server.onNotFound(handle_NotFound);
server.begin();.
.
.
.

if (WiFi.status() == WL_CONNECTED) server.handleClient();

void handle_OnConnect_VALUES() {
server.send(200, “text/html”, SendVALUES(tempInside,tempOutside,relayState));
}

.
.
.
String SendHTML(float tempInside,float tempOutside,int relayState){
String ptr = " \n";
ptr +="<meta name=“viewport” content=“width=device-width, initial-scale=1.0, user-scalable=no”>\n";
ptr +=“NodeMCU Solar regulator\n”;
ptr +=“html { font-family: Helvetica; display: inline-block; margin: 0px auto; text-align: center;}\n”;
ptr +=“body{margin-top: 50px;} h1 {color: #444444;margin: 50px auto 30px;}\n”;
ptr +=“p {font-size: 24px;color: #444444;margin-bottom: 10px;}\n”;
ptr +="\n";
ptr +="\n";
ptr +="\n";
ptr +="<div id=“webpage”>\n";
ptr +=“

NodeMCU Solar regulator

\n”;
ptr +=“

Outside: “;
ptr +=tempOutside;
ptr +=“°C

”;
ptr +=“

Inside: “;
ptr +=tempInside;
ptr +=“°C

”;
ptr +=“

Cerpadlo: “;
if ((relayState)==HIGH) ptr +=“OFF”;
if ((relayState)==LOW) ptr +=“ON”;
ptr +=”\n”;
ptr +=”\n”;
ptr +=”\n”;
return ptr;
}

So from everywhere I can read on IP of NodeMCU data
This I can do for all devices separately on his own IP