Ubidots Community

A variable does not change on dashboard neither in device

Hi, can someone help me?
I’m making an project with ESP32, I create my dashboard and device, but only one variable does not change. This is my code when ESP is publishing the variables

Specifically the variable named weight

Only one time changed, when I connetc my ESP32 the first time to my WiFi network, but in serial monitor the variable is changing like the capture below

In dashboard I have enabled real time, but weight is not changing

Do you think is a bug on Ubidots or an error in my code?

Hello @ewicabh ,

Thank you for sharing this issue with the community.

Now, the reason why you’re missing a variable could be for different causes. One of them is because you’re probably surpassing the limit of requests per second allowed by our API. Please be aware that STEM accounts can send up to 1 request per second across all your devices and, according to your code, your device is executing a publish per variable as fast as the device can, surely faster than 1 second.
To solve this, we do recommend sending all variables in a single publish that in the topic points to the device. In that sense, the topic should have this format “/v1.6/devices/DEVICE_LABEL”. This also means that you have to wrap all variables and values into a single JSON body so that it can be sent. The JSON body should look like the below:

{"distance": 37, "battery":3.8, "weight":323, "error":0, "cellular":0}

Please let me know how it goes after implementing the changes, so we can check other possible causes.

In addition, we do have an Ubidots-ready library for the ESP32 device, that eases the necessary code to publish and subscribe to variables, in case you want to explore it.


Hello @sergio , thanks for you support.
As you said, you have reason, my account only has 1req/sec:

and I can’t to set it to put more req/sec, I think because its the default value, but I tried in other account that has 4 req/sec:

and in that account I can see the changes in the value, I mean, the value is updating acording to my code:

in those days I’m goint to try sending my variables in a single publish modifying my code, and I will let you know after implementing the changes, but for now my variable is changing.
Thanks a lot!