Homey uses “Tags” to save information / data that you can reuse in your flows.
A tag is a variable and can be one of the following types: String, Number, Boolean or Image.
A variable is a placeholder for a value that can be changed while the flow is running. By using variables the information that is retrieved from a device or calculated in a flow can, in the form of Tags, be used elsewhere in the same flow or in another flow.
Some variables are set by devices or functions, such as e.g. temperature in a thermometer or time in the clock function. And other variables you are able to define and edit yourself, such as the value of a countdown or a calculated mean of several temperatures.
Variables of different types may contain different information:
String contains characters. Numbers in a String are handled as text and not as numbers.
Number contains numbers. This type can be used to calculate, set, save and retrieve values.
Boolean can be Yes or No. Boolean is usually used to check a status, e.g. on / off or true / false.
Image contains an image, eg a snapshot or an album cover.
Looking at the flow cards you will notice that some cards have a small “tag” icon, clicking on that icon will bring forward a list of available tags. Based on what information the card can handle you will only see tags/variables of matching kind.
Browsing through the tag list you will see that there are many different tags and based on what devices and apps you have installed the list can become quite large. Make use of the search function.
Is there any special syntax? I tried to make an incredibly annoying test with a Trådfri dimmer.
When: dimmer stopped rotating
Then: Say Dimmer rotated to Value*100
It just says that the dimmer rotatet to “0.75 times 100” or something.
You will have to do the calculation first in a separate card and save that as a variable. The say card read out exactly whats in it so if you then have the say card use that variable you get the result you expect.
Tags with numbers are in blue and have a # infront of the values.
Tags with text (string) are in green.
Tags with yes/no (boolean) are in red.
Only blue tags can be used in calculations.
Thanks. Got it to work with better logic, but I can’t find where to declare variables for the built-in logic function. Would appreciate it it if you bear with me. Starting to see some really cool possibilities with this controller
I used this calculation in standard homey variable calculation to convert a number (in string format from MQTT) to valid dim-value for a homey dimmer:
{{round(number(<variable/tag)/254,2)}}
Where <variable/tag> is the variable or tag with string that you want to convert. In this case a value between 0-254 that converts to 0-1 with 2 decimals.