items.md: override labels (#738)
* items.md: override labels Added information about how to override label text and state representation on sitemaps. Signed-off-by: Josua Arndt <josuaarndt@live.de> * Typos * Add item override example Signed-off-by: Josua Arndt <josuaarndt@live.de> * Added UoM link Signed-off-by: Josua Arndt <josuaarndt@live.de> * Update code fences and example comments Signed-off-by: Jerome Luckenbach <github@luckenba.ch>pull/740/head
parent
cb42e0abe4
commit
0987df46f6
|
@ -208,12 +208,14 @@ Graphical UIs will display the label text when the Item is included, e.g. in [Ba
|
|||
Some I/O services (e.g. the Amazon Alexa skill) also use the label to match an external voice command to an Item.
|
||||
|
||||
In textual configurations the label, in quotation marks, appears next to the optional state presentation field in square brackets (see below).
|
||||
The label for the Item in the following example is "Temperature":
|
||||
The label for the Item in the following example is "Temperature and the optional state representation is set to be displayed, e.g. as "23.9 °C":
|
||||
|
||||
```java
|
||||
Number Livingroom_Temperature "Temperature [%.1f °C]"
|
||||
```
|
||||
|
||||
Channel labels can be overwritten by Item definitions and Item labels can be overwritten in [Sitemaps]({{base}}/configuration/sitemaps.html#element-types).
|
||||
|
||||
{: #state}
|
||||
### State
|
||||
|
||||
|
|
|
@ -152,6 +152,25 @@ This provides the flexibility to present Items in the way desired in your home a
|
|||
If no label or icon are specified in the Sitemap, then the label and/or icon you assigned to the Item will be displayed.
|
||||
Setting a value for `label` or `icon` of a Sitemap element will override the values defined for the linked Item.
|
||||
|
||||
It has to be considered that if the label defined in a Channel or an Item contains text and state, these representations have to be overwritten separately in the Sitemap.
|
||||
In the following example a Item which has a label and state defined is overwritten.
|
||||
|
||||
```java
|
||||
sitemap demo label="My home automation" {
|
||||
Frame label="Temperature" {
|
||||
// Overrides only the text, but will keep the state format from the Item definition
|
||||
Text item=Livingroom_Temperature label="Livingroom"
|
||||
// Overrides the text and hides any state representation.
|
||||
Text item=Livingroom_Temperature label="Livingroom []"
|
||||
// Overrides the text and state representation
|
||||
// and also changes the state unit to Fahrenheit
|
||||
// if the value of the item supports UoM (link below) the value will be transformed.
|
||||
Text item=Livingroom_Temperature label="Livingroom [%.2f °F]"
|
||||
}
|
||||
}
|
||||
```
|
||||
UoM = [Units of Measurment]({{base}}/concepts/units-of-measurement.html)
|
||||
|
||||
- Additional parameters such as `mappings` and `valuecolor` are described below.
|
||||
|
||||
### Element Type 'Frame'
|
||||
|
|
Loading…
Reference in New Issue