An icon or text, with no writing to backend, only displayed when the value of item is equal to defined value. Symbols may be used in menus.
If more than one item is given, they will be combined with formula.
zero, one or more item(s). More items in array form: [item1, item2] (optional)
text
the text, printed when item has value val (optional)
icon
the icon shown when item has value val (optional, default 'control_on_off' if text is empty)
dynamic icons can be used, e.g. icon.light('', '', value_item); please note: these must not be wrapped by apostrophs (')
value
comparative value(s) (default 1)
formula
'or', 'and' or any JavaScript expression with following variables, result will be compared to comparative value above. Additionally you can use 'min' and 'max' to test if any of the defined items has a value >= or <= comparative value (default 'or')
VAR1, VAR2, ... represent the corresponding item's value, VAR is an array of all item values
If the formula starts with a greater than symbol '>' the value will be treated as threshold. The symbol (text, icon and color) according to greatest reached threshold will be shown. The first symbol is the base for values below first threshold, so pass one symbol more than values.
If '>' is not used, symbols will only be shown if the item value matches exactly one of the given value parameters
color
the color 'icon1' or e. g. '#f00' for red (default 'icon0' of the design)
this only applies to text, if no icon is set (for backward compatibility)
href
URL to use as link (optional)
rel
used in combination with href as data-rel attribute {e.g. to open a popup} (optional)
Standard Icon if both values are 0
Sound icon if at least one is <=1 and one > 0
no icon when one of the values is 2
lock icon if one of the value is >= 3
Combinations with 'or', 'and' or custom formula (this one implements XOR, so the text is shown if one and only one flip is set on).
Use both flips (one for 'bath.light.switch' and the other for 'bath.rtr.state') to control the symbols
If you combine multiple items with or and on/off (1/0) states you have to put 1 as first value and 0 as sescond.
Explanation: By using or the first match of any item with a value will be evaluated. So if you set 0 in front, this condition will be met if any of the items has value 0. But most likely you want to show off state only if all values are 0.
{{ basic.symbol('', ['bath.light.switch', 'bath.rtr.state'], '', '', [1,0], 'or', ['green','red']) }}