Communication between devices

Hello community

I try to connect two ESP8266.
My project is to measure the temperature of 3 sections of our 3000lt Puffer of our wood heating sytem with a ESP826 and sending the values to a second ESP8266.
The second one will have a display witch shows the temperatures, so my mother can see it from her kitchen and dont have to run 10 times a day in the cellar to prevent of cooling down the heating system.

I found on the documentation sheets the “Communication between devices” section,and ist seems to be the right choice.

So first of all i try d to connect two devices and turn on/off a led:

Device A


thing[“onoffled”] << digitalPin(onoffled);


Device B

thing.call_device(“myName”, “onoffled”);
I understand it as when i go to the API Explorer there would appear a new resource. is this right?

when i open the API explorer the refresh sign turns and after a while it gives me a error message.

Can Anybodybody help me?


in the API explorer, for your device A, there should be an onoffled resource where you can turn your led on and off. For your device B, it will not expose any resource in the API, and it is likely to get disconnected from the server as it is flooding the server (in every loop is trying to call the resource from the other device). So, your device B should point to your device A, not sure if myName is the name for device A. The resource name is ok. However, you should send son on/off state to see any change, so, for your testing purposes, I will suggest to change your device B code for testing to something like:

bool lastState = false;
void loop(){
  lastState != lastState;
  pson data;
  data = lastState;
  thing.call_device("deviceA", "onoffled", data);
  // do not add delays in your code, use millis for better response

In this case, the device B would be sending a true/false value every 5 seconds to device A, so you should see your device A turning on/off the led every 5 seconds.

Note: If you are using two ESP8266 over the same WiFi, for your use case you can just use the ESP-Now, and keep connected to the platform just one device if you want to see the information over the internet. But I think that it is more complex than this solution :wink:

Hope it helps!

Thank you Alvaro :grin:

if(millis() - previousmillis > interval){
previousmillis = millis();
lastState = !lastState;
pson data;
data = lastState;
thing.call_device(“mydevice”, “led”, data);

is working.

1 Like

My setup is 3+ devices communicating to a hub that does the data aggregations and alerting back to I followed the examples and I have the devices pushing to the hub. Is it possible to have the hub pull from the devices? Ideally…

1 - I set up a device (really ideally there is auto provisioning)
2 - hub can get a list of devices
3 - hub can loop over the list of devices asking each of them for their data every 10 min, then write back to

Then I can add as many as I want without reconfiguring the hub.

Also, is there a way to have startup variables that are external and sit in

The functionality that you are asking for is done by the server.

There is a way to pull variables from devices, by http requests and tokens (as the mobile app does), nothing implemented in examples.

In the same way we were talking about pull last bucket resource, in order to keep for example a counter in case the remote device restarts, I found how to make the http request to a bucket (and saw the values in serial console), but I don’t know how to pair received data with the remote unit variables.

So if is that what are you looking for, I have not seen something done yet, if you can achieve that it will be really helpfull if you share it with us