Skip to content

Commit

Permalink
[sitemap] New optional icon in mappings
Browse files Browse the repository at this point in the history
Related to openhab/openhab-core#3809

Signed-off-by: Laurent Garnier <[email protected]>
  • Loading branch information
lolodomo committed Nov 4, 2023
1 parent eea8faa commit cf1d07a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ui/sitemaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ A Switch will present a discrete state Item and allow changing of its value.
Note that Switch elements can be rendered differently on the user interface, based on the Item type and the `mappings` parameter.

- `mappings` comes as an array of value-to-string translations, [documented further down](#mappings).
Without the mappings parameter, user interfaces will present an On/Off Switch, if mappings are given, several labeled buttons will be rendered.
Without the mappings parameter, user interfaces will present an On/Off Switch, if mappings are given, several buttons with label or icon will be rendered.

**Examples:**

Expand Down Expand Up @@ -540,7 +540,7 @@ Mappings is an optional parameter for the [Switch](#element-type-switch) and [Se
Mapping syntax:

```java
mappings=[value_1="description_1", value_2="description_2", ...]
mappings=[value_1="description_1", value_2="description_2"=<iconname>, ...]
```

Examples:
Expand All @@ -551,6 +551,8 @@ mappings=[1="DasErste", 2="BBC One", 3="Cartoon Network"]

mappings=[OFF="All heaters off"]
mappings=[15="Gone", 19="Chilly", 21="Cozy"]

mappings=[ON="Mic On"=material:mic, OFF="Mic Off"=material:mic_off]
```

As you can see, different Item data types are accepted as mappings values.
Expand All @@ -566,6 +568,9 @@ Similarly, mapping above changes the numbers "1", "2", and "3" to "DasErste", "B
In the third and fourth examples above, only a subset of the possible values of items belonging to a heating system are presented to the user.
This limits the possible input values, which is yet another often occurring use case for mappings.

In the fifth example above, user interfaces will display buttons using the provided icon rather than the provided description.
Icons are usable in Switch element but ignored in Selection element.

## Dynamic Sitemaps

All Sitemap elements can be configured to be hidden, color highlighted or to have a [dynamic icon]({{base}}/configuration/items.html#dynamic-icons), depending on certain Item states.
Expand Down

0 comments on commit cf1d07a

Please sign in to comment.