Problems in sitemaps mappings with numbers / Dimmer

Hello,

I’m having a hard time with sitemaps and number items. In this case I have a group of Dimmers or number items, but the same applies also to single Dimmer / number items:

Selection item=gDimmLightEG label="Dimmer" mappings=[0.0="Aus",2.0="Ambiente",21.0="Gedimmt",50.0="Mittel",100.0="Maximum"]

In this case I use mappings 0.0, 21.0, etc. to map the value. Sometimes when an item changes, the Selection is thus shown correctly in BasicUI, sometimes though the value of the group is just 50 without the .0 when I log the state to the console and then the mapping does not work.

Is it possible to have multiple values mapped to one label, like 0.0=“Aus”&&0=“Aus” or something similar? Or can I somehow get actually rid of the .0 in the values?

The same problem happens to me for instance with IKEA Tradfri bulbs when I want a switch with mappings to 3 different dimming levels instead of a slider. Very often there is nothing selected because the value of the dimmer is either with .0 or without and the mappings descriptor is just the other one.

Any help would be appreciated.

If the Item is a Dimmer it carries a PercentType which can only be integer values between 0 and 100. So first of all, you should be using 0, 2, … for your mappings and avoid using the .0.

That should solve the problem with Dimmers as the only thing that would be trying to set it to 21.0 is your sitemap.

The problem is more complicated with Number Items. The only way I can think of to handle this are:

  • make sure that everything that updates or commands these Items only uses decimal points or never uses decimal points
  • create a proxy Item and use a Rule to strip off the decimal point or add the decimal point when it is missing.