Items in sitemap, mappings

Hi,

I’am using the latest docker of OH 2.5.3.

I prepared some items in *.items … with Type, Text, Icon, Channel …

When adding to sitemap i have different options: default item=xxx or e.g. Switch item=xxx

When adding mappings=[] I have to add the label parameter to get rid of error messages in logfile and have to enter there the same text as in items defined. Why?

I think the items-file is for preset all items with all properties and using them at any position in a sitemap as i want - by now, i have to copy the same line out of sitemap and use it anywhere else in the same file.
But if i want to change something, may be the formatting string, then i have to change a lot of lines where this item appears.

Is there a trick to add a item like this: Default item=xxx mappings=[0=“closed”]

Regards

PS:

I figured something out: My item is defined as Rollershutter in items, but in sitemaps i have to use Switch instead to get it working with Switch item=xx mappings="[…]".
If i am using Default or Rollershutter instead, it doesn’t work.
Why?

Where can I find some informations about that? In the documentations is nothing to found.

Example? Error message?

In general, you can specify a label in your Item definition. This label may or not have state formatting details (including transformation) in square brackets [ ]

Optionally, you can specify a label in your sitemap widget. If given, this overrides the label in the Item definition.

Yes.

The widget type you choose to use in a sitemap is NOT directly related to the Item type that you choose to use it with. You can use a Switch widget with a String type Item.
Not all widgets offer the same features, that’s why they are different widgets.

Configuration model ‘home.sitemap’ has errors, therefore ignoring it: [12,41]: mismatched input ‘mappings=[’ expecting ‘}’
[60,2]: missing EOF at ‘Frame’

If only we knew what your sitemap content was.

Yes, but why do i have to define Rollershutter in Items and Switch in sitemaps to get it work?
When i am write switch instead of RS then i got errors.

I want to have some presetted buttons with some values.

I am using the freeathome binding and it want to have percentages.

Because the Switch sitemap widget offers the mappings= feature to allow you to define your own buttons.
There is no RollerShutter sitemap widget.

Again, despite the sometimes similar names, the widgets in sitemaps have little to do with the Item types they are used with.

Sounds like the ideal job for a Switch widget with mappings=[]

Ok, i think i have understood … i am not confirming everything (on openhabs’s system) but i think i can go on.

Thanks

Here are three different ways of using mappings. Notice the type, Selection, Switch and Setpoint:

Selection  item=Nilan_Control_ModeSet   mappings=[0="Off", 1="Heat", 2="Cool", 3="AUTO", 4="Service"]
Switch     item=Nilan_Control_VentSet   mappings=[0="0", 1="1", 2="2", 3="3", 4="4"]
Setpoint   item=Nilan_Control_TempSet   minValue=0 maxValue=65 step=1

(The last one is a setpoint with static mapping/step).

Hope you can make use of anything of it.

1 Like