Defining variables in MQTT Tiles allows forming the drop-down lists to select from the items of the same type (e.g. channels, devices, streams, custom entities) and populate the widgets on the boards with the values associated with the selected entity.
For instance, you have several devices connected to flespi. If you define a variable <%device_name%>, you will be able to select the needed device from a drop-down list and have the widgets populated with the values taken from this device messages/telemetry/etc.
Variables are added in the board settings either upon creation or later on. If you decide to add variables to the existing board, go to the three dots on the board card and select Settings:
Then find the Variables section in the opened dialog and configure the desired variables:
The Presets field allows selecting from the most used variable sources — channels, devices, or calcs taken from your flespi account.
If you want to take variable values from a custom topic, pick Custom from the Presets drop-down, then pick Source from the Type drop-down, and specify the topic to take the values from.
If you need custom values for variables, pick Custom from the Presets drop-down, then pick Custom in the Type drop-down, and populate the custom values manually in the Items section:
Now you can open the board in the Full board view and add widgets that incorporate the values from the added variables.
When you open the dialog to add the new widget, you will see the (x) icon next to the drop-downs. Click on this icon to select the variable that will be used to form the source topic for the widget.
Select the proper variable and parameter(s). Note that the parameters can also be selected from variable values if the suitable variable exists.
Say, we want to convert the speed value to mph before showing it on the widget:
Here’s the resulting widget showing the speed in miles for the selected device:
Remember, variables in MQTT Tiles can be used only for forming subscriptions with the changing value on a certain level (or levels).