Swiches with mapping: error in WEB-UIs (Basic+Classic)

But this will still not show me a single button that is off/not highlighted when the item is not in the mapped state and than as long as the item is in the mapped state show me a button that is on/highlighted.
Independently of where the state change came from, eg rule or ui, and when you press it triggers a change to the mapped state. Because that’s exactly how it behaved before.
Can you please post an example Sitemap code for your two switch visibility solution that achieves this, because I don’t quite understand it?
If you look at the first post in this thread you see that android app too behaved in our expected way.

1 Like

Anybody knows, how a number item with one mapping is behaving?

Set it up in your sitemap like this:

Switch item=SomeItem icon="light" mappings=[ON="Turn ON"] visibility=[SomeItem=="OFF"]
Switch item=SomeItem icon="light" mappings=[ON="Light is ON"] visibility=[SomeItem=="ON"]

Okay, I tried a version with visibility. Here is my new sitemap definition:

Switch	item=EMD_07_05			label="SWITCH V1"				           
Switch	item=EMD_07_05			label="SWITCH V2 []"   mappings=[OFF="Off",ON="On"]		
Switch	item=EMD_07_05			label="SWITCH V3 []"   mappings=[ON="On"]					
Switch	item=EMD_07_05 			label="SWITCH V4 []"   mappings=[ON="OFF"] visibility=[EMD_07_05=="OFF"]
Switch  item=EMD_07_05 			label="SWITCH V4 []"   mappings=[ON="ON"]  visibility=[EMD_07_05=="ON"]

And here is how it looks in the BasicUI:

If the switch is ON the representation is still wrong, because the color is wrong. So it changes nothing…

Now I made some tests with a numeric item:

Switch	item=Chart_Period   label="Chart period"    mappings=[0="1 T"]
Switch	item=Chart_Period   label="Chart period"    mappings=[         1="3 T"]
Switch	item=Chart_Period   label="Chart period"    mappings=[0="1 T", 1="3 T"]
Switch	item=Chart_Period   label="Chart period"    mappings=[0="1 T", 1="3 T", 2="1 W"]
Switch	item=Chart_Period   label="Chart period"    mappings=[         1="3 T", 2="1 W"]

The result for values 0,1,2 are as follows:

This is also not working as it should…

I know what you want to do with your Sitemap code. You are mapping states to the actual mapping string using two items. But this is a rather ugly workaround which is neither in line how other mappings represent their state, eg colour highlighting, nor does it offer the quick glance comfort that a coloured highlight representation does. Explain to me how the new behaviour makes mappings more consistent within themselves? Why is it logical when mapping always works one way and than out of no where it changes it’s behaviour for one case. I can’t see how this is intuitive ui design.
Maybe the basic ui was the one with the bug not showing the mapping state correct and the android and iOS app where the ones doing it right for years?
Just a thought.
I know you mentioned this issue in the context:

I actually see this user trying to use a switch as a pushbutton going against the idea of a switch item. Because a switch item is supposed to remain in its state as long as we don’t change again to its other state. That’s how openhab switch items work. Why not represent them as such even if the mapping hides one of the states, because that’s all we are trying to do. You even say it yourself in the github thread.
I’m sorry for being so stubborn on this issue :joy:

And the example with the numer item shows, it is possible to suppress some states.
So I can’ t see, why I can supress a third, fourth… state, but not a second.
For my, this is a bug not a feature.

1 Like

Can you please point me at the part of the code on github that deals with this/mapping in the ios app?