In basic ui switch state is false

Hello @all,

i’ve a problem with the basic ui. I’ve got a switch for a exec binding when i turn it on the state of it is ON but if i refresh the basic ui it say ON and the slider is off. You can see what i mean in my screen shot.

my configs:

item:
String pilight_WZ_Lampe_2 “Lampe im Strauch” {channel=“exec:command:pilight_WZ_Lampe_2:input”}

things:
Thing exec:command:pilight_WZ_Lampe_2 [command="/etc/pilight/WZ_Lampe_2.sh %2$s", interval=0, autorun=true]

sitemap:
Switch item=pilight_WZ_Lampe_2

If i use the openhab app on ios it show it correctly!

Can anybody help me?

Thanks
Manuel

I think the Switch sitemap widget (which is slightly different in each UI) doesn’t work so well with String type Items.
You should try it in ClassicUI for a surprise … you get a TOGGLE command :slight_smile:

I think this is a bug in the basic ui for browsers. Becouse it is only in the website on a browsers. In the ios spp it’s work fine.

Have i any possibility to fix it?

thanks
Manuel

Please feel free to open an issue. Guessing it’s core, but not sure :wink:

It’s not a bug as such. Why would a Switch widget slider work with String Items? It’s a reasonable enhancement request though, and it would certainly be good if the various UIs were consistent.

Things to think about - presumably you’d want to treat string “banana” the same as NULL. But how about “ON”, “On” and “on”. Should they be equivalent? I would expect the clicking of the slide-switch to always produce command ON, not string “ON”, although there is very little difference when it arrives at openHAB.
What about the TOGGLE that ClassicUI can make?

Meantime, you could make it work using the buttons mapping method, but it will look very different
Switch item=pilight_WZ_Lampe_2 mappings=[ON=“On”,OFF=“Off”]

Hmm…

But a Switch widget with mappings does work with String and Number items.

So as long as the string value is the same as the normal status of a switch item, I would expect correct behavior.