Ubidots Community

Water Pump variable

I currently have a device sending the water pump State. 1 = ON 0 = OFF. Is there a way somewhere on Ubidots I can convert to display and store the Text (On or OFF), not the numbers( 1 or 0)?
thank you.

Good day @Josefdz,

Thanks you for sharing your question with the community.

Yes, you can create a switch widget in case you want to control the water pump from Ubidots, using that widget you can display ON/OFF messages. Also, in case you only want to display the text the recommended widget will be the indicator one.

Please let me know if you have further questions.


Hello @isalogi,

What you sent me it looks like for me to send On Off commands. What I would want is to be able to change the 1 or 0 values to ON OFF. For example in this picture you can see on the variable result 0.00. I don’t want to show this numerical value. I would like to show the ON or OFF value.
Thank You!

Hi @Josefdz,

Ubidots accept numerical values, but not string ones as the value of a variable. To store string data, you need to add it as a context to the value as shown below:

{"water-pump":{"value": 1, "context":{"message":"ON"}}}

Please refer to our API documentation to know further about how to send metadata to Ubidots. That will be visible inside the variables view, but no in the variable list, as it only shows the last value received.

All the information store in the context of a variable can be display using the metric or tables widgets. Please refer to the following article to learn how,

All the best,