Get additonal state in sitemap of item

I have a Dimmer item who has additional state types (see here at the bottom
Main state is PercentType but it has also the state type OnOffType.

If I add this item with default to the sitemap I get of course a dimmer item.
If I change the type to switch I get the switch item.

But I want to show instead of the switch 2 buttons with “ON” and “OFF”.
With a standard switch item I use a mapping with “ON=” and “OFF=”.

This is not possible with the dimmer item because it checks always the state of the current dimmer value.
For example state=1 or state=50.

How can I access inside the mapping the alternative state “ON” and “OFF”?

Just use a Switch sitemap element with your Dimmer Item. Something like:

Switch item="myDimmerItem" label="myDimmerItem []" mappings=[ON="ON", OFF="OFF"]

Or if you want to provide absolute values:

Switch item="myDimmerItem" label="myDimmerItem []" mappings=[100="ON", 0="OFF"]

Thanks I have already do this.

The problem is that now I don’t see the current state.
Both buttons are not enabled because the item state is reported as state=1 or state=50 and so on.

So I want to access the alternate state because this would be on state=1 or state=50 “ON” and if state=0 it would be "OFF.

Ah, I see. I don’t think this is possible.

This might help:

1 Like


I have exactly searched for something like this mentioned in the linked post from you:
mappings=[as OnOffType==OFF ="Off" ...

But as also mentioned this is not possible.
So I will add an virtual item for this.