Random state change and update from Arduino IoT Cloud

I noticed strange behavior of the Cloud.
I connected a clean Arduino Nano 33 IoT, I added 3 variables (and 3 widgets) and only led on/off sketch for 1 switch. When I upload code or reset the arduino after connecting to the cloud the led state is updated randomly from the cloud. Dashboard changes its settings randomly. Sometimes it stays "1", sometimes it changes to "0". The other two variables also change their states randomly. Sometimes one comes on, sometimes two at once.

I added a second Arduino Nano 33 IoT, with 3 new variables and a new dashboard. Now, every time when board connect to the cloud, if Switch is set to ON in the dashboard, the other two variables are turned on too by themselves. If Switch is set to OFF then the other two Variables will not turn on.

Did I miss something? is this normal cloud behavior? If not, how to avoid such random data from the cloud.

#include "thingProperties.h"

void setup() {




void loop() {

void onColoredLight2Change()  {


void onColoredLight1Change()  {

void onSwitch1Change()  {
  if(switch1 == true) digitalWrite(LED_BUILTIN, HIGH);
  else digitalWrite(LED_BUILTIN, LOW);

Hi nixietester,

I had the same issue and solved this by setting my variables in the sketch too. I had 3 booleans and wanted to switch relay depending on a measurement of distance (ulrasonic). Within specific ranges I needed the 3 variables to be true or false. As long as I had set the variables just in the cloud they became randomly true or false, just by setting them true/false depending of an if-statement they became what they should, no randomness any more.

But now I have a new issue: Changing the variables in code seems them not to switch my relais any more??? The "OnChange"-Method seems not to be called on programatic change of variable :frowning:

Perhaps you have an idea?



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