Lookup text for integer values

I have an IoT device that is sending a system-status integer that maps to the following values:

0: Standby
1: Unused
2: Discharge
3: Fault
4: Flash
5: PV charge
6: AC charge
7: Combine charge
8: Combine charge and Bypass
9: PV charge and Bypass
10: AC charge and Bypass
11: Bypass
12: PV charge and Discharge

I would like to create a dashboard widget that shows last-value and will substitute the raw-value of ‘11’, for example, with the text “Bypass”.

Is there a way to do this? Likewise, if I put this value in a timeseries as a dot, I’d like the tooltip to display the text and not the raw number…

Here the system_status should read “Standby” instead of ‘0’.

Is this possible with the STEM license? (this is a personal project for myself, not commercial)

Thanks!

I think I figured it out - I can send the label as context to my variable and then access context for the widget.

Hi @h00die,

How nice you found a solution using Ubidots resources, specifically the Help Center.

Complementing your solution, here are other options (or limitations) for your consideration:

1. Indicator widget: this widget allows manually entering a color logic that not only changes the color based on the value, but also displays a fix text. See image:

2. Using context: while it is true that you can send the strings in the context, please note that not all widgets support extracting data from the context, the line chart being an example.
However, widgets like the tables (in all of its variations, namely, values, variables and device tables), or the metric.

We hope this helps and provides further clarification.