XTension Units support an “Advanced Label Syntax” that lets you include several points of information or data into the value field of a single unit. You can enter the Advanced Label text into the ON and Off Label fields of the Edit Unit Window - Display Tab.
Since the defaults of “On” and “Off” don’t make sense for everything these fields let you customize the unit value display. In the case of door sensor it might be as simple as “Open” and “Closed.”
The fields support an “Advanced Syntax” that lets you include many other data elements or labels without any scripting necessary at all. Any string that you place within these fields will be displayed in any Value field in the program or the web or other interfaces.
Any text not inside of <>’s will be passed through without changes.
Tags are not case sensitive. All tags support an optional parameter of unit=“some other unit name” and if included the value will be taken from that unit and not the unit that contains the label you are editing. Without this parameter the value is taken from the unit you’re editing.
The current numerical value with the Format String applied and the Unit Of Measure suffix added at the end.
The raw, unprocessed value of the unit before the application of the format string or any other processing.
Replaced with the description of the unit
If no other parameters are returned then it is replaced with “On” or “Off” Many optional parameters can make this tag significantly useful.
This includes the fully processed ON or OFF label from another unit. In this case the usually optional unit=“some other unit” parameter is not optional. You cannot embed the label from the current unit into it’s own label.
The timestamp of the unit, at least some formatting data must be included to say how you want to format the date. These are the same date formatting options of the xtFormatDate verb.
Includes a unit property value as long as it’s a string or a number.
If the unit property is updated all value displays will be updated to reflect the new value.
Forces a line break or inserts a new line character. This will force a new line in a unit value display but may not format properly in a list window or a unit icon display.
The <br> tag has no optional or required parameters.
I have a mySensors based barometer. It returns the barometer value in one unit and the simple forecast that it does in another. I would like to see them together in one display so in the On Label of the value unit I’ve written:
<value> (<description unit="Barometer Forecast”>)
which results in an output of 1106.4hpa (stable)
to make a temperature/humidity display:
<value>°F <value unit=“humidity”>%
results in a display of “75°F 45%”