Connection indicator

I am using the arduino iot cloud. the problem is as follows. if i power down the esp32 and go on my phone to arduino cloud i see my button to get to the dashboard i need. problem is the dashbord works even though the esp32 is powered down. of course nothing happens with the esp32 since it is powered down. the dashboard doesn't recognize the esp32 is powered down. how do i indicate on the dashboard the esp32 is down. the arduino cloud connects fine.
I hope this makes sense.

thanks

Welcome to the forum!
Your topic has been moved to the IOT Cloud category, more appropriate to the question you have.

Hi, Arduino Cloud has a device button at the top.

Click it then you can see that the device is offline.

As for the dashboard: you could create a bool that is set to true on device power on.

And sets to false right before sleep code.
Let me know if this helps.

below is what is on a dashboard also on my phone. here is the problem. the slider works and the on/off button works. but i have the esp32 powered down. the buttons work but of course the esp32 does nothing since it is powered down. how can i tell if the esp32 is on or off. i have no problem connecting to arduino cloud.

image

Add a Boolean and a status widget.

I will give you some code to adapt in a few hours.

Here it is.

/*
You will need to make a cloud boolean for this to work.
I named it connected.
Paste this code in to your cloud program.

*/
void setup() {
  
  connected = true;
  // do your setup things


}

void loop() {
  // do your loop things
// wake up
  connected = true;
  // do your stuff
  
  
  // now to go to sleep
  connected = false;
  // put your go to sleep code here.
  goToSleep();

  

}

Here is what you can use on the dashboard:
It's called status. It is a widget.

Thanks, trying it now

Bill Wolitich

moderator edit: pii removed

No luck, will get back with you. Blynk looks like it works, giving that a try.

thanks

Bill Wolitich

moderator edit: pii removed

I tried everything I know. I can’t get the status or led widget to work (read/write enabled, boolean). If on the dashboard I click the led should it change colors? Or would it only change if I change the variable in the sketch. So, I tried both ways and nothing happens. The same holds true for the status widget.

Are there issues with these widgits

thanks

Bill Wolitich

moderator edit: pii removed

Not sure if I understand your question.
If you want to use the sketch I made make the bool read only.

This is the dashboard

The variables led & statusButton (this is a status widget, not a button, I just named the status widget statusButton) are both Boolean read only(also tried with read/write)

Here is the code

void loop() {

ArduinoCloud.update();

if (ArduinoCloud.connected()==0){

led=false;

statusButton=false;

}

else{

led=true;

statusButton=true;

}

Serial.print("led:");

Serial.print(led);

Serial.print(" statusButton: ");

Serial.println(statusButton);

delay(1000);

}

The led and statusButton on the dashboard, always green, never change, the serial print shows the 2 variables change value but not the widgets themselves. When I start the sketch I immediately got to the dashboard because the value of both is 0, then after a few seconds and connect the variables change to 1 but the widgits stay green even when variables are 0.

What am I doing wrong

Thanks for your help

Bill Wolitich

moderator edit: pii removed; code tags added

You are setting a cloud variable to false when you are not connected to the cloud.
In the future please use code tags to post code.
Why do you need two bools?

@dbeamonte_arduino

@datastat, stop including PII in your posts.

1 Like

thanks, new to posting...

2 Likes

i've tried this, the status still doesn't change. I am connected. i went as far as to change the status from 1, delay 1 second , 0, delay 1 second in the loop, the status is always on.. are you sure there isn't a problem with the status widgit.

thanks for your help.

Have you declared the cloud variable in thingProperties.h page, can we see that?

1 Like

image

And where is your onOff variable in the code from post #12 ?

1 Like

i also tried 1 and 0 instead of true and false for onOff

thanks

void loop() {
  ArduinoCloud.update();
  onOff=false;

  delay(2000);
  onOff=true;

  delay(2000);
 
  Serial.println(ArduinoCloud.connected());
}