I’m not sure if the following is a bug or the intended behaviour; I was struggling with this issue since I began to use Openhab, however, and I want to hereby share it:
When you map the states of switches like this:
Switch Notmodus "Notmodus [MAP(janein.map):%s]" <error> (Heizungsstatus)
and a map like this:
Basic UI & the Android App won’t update the state of switches neither their associated icons.
If you define the switch as text, it will work (hence show the defined/mapped strings), if you define it as switch, it won’t (hence not “flipping” the switch nor changing the icon e.g. from lit to unlit) . Maybe that’s because the switch state is being handled as a string and this string is wrongly interpreted after transforming?
As soon as you remove the mapping, everything works fine with both Basic UI and the Android App.
I can confirm that behavior with the iOS app and openHAB 2. As soon as there is a map for a switch like that
Switch Ruhemodus "Ruhemodus [MAP(switch.map):%s]" <sound> (Status)
the Switch item can’t be used via the app. When you switch it on, openHAB receives the update, but the switch changes back in the app ui to OFF.
I tested the contents of the map-file, but it doesn’t seem to be a problem of it.
This is a problem regarding openHAB 2. Nothing wrong with version 1.x.
There seem to be further problems, which also could be caused by this bug (?).
Removing the mapping in the item definition helps with using the item as a switch in the app just as stated above. But when using the item as a text item like this
there is no state output at all. If I’m not mistaken there should be “OFF” or “ON” as a text item in the app, but the only thing you see is the icon and the label.
Also the on- and off-versions of the icons don’t work anymore in this case. Only the standard fallback icon is shown.
So there seem to be a general issue with switches as text items at least in the iOS app.
I push this, because it really seems like a bug. And maybe this thread should be moved to another board more regarding possible bugs.
Does nobody else face this issue? Is this the intended behaviour or should I open an issue for that?
I doubt that this is intended. It worked fine with openHAB 1.x. But it seems that nobody cares…
There is a
detailed exploration here
I have been trying to get this to work also. It is more complex than it seems. This is what I have found.
@mohsh86 is correct. The icons map to the transformed value, not the underlying state of the item. I am transforming the label of my item, so that OPEN/CLOSED becomes OnLine/OfflLine. I have to create a network icon called network-online.png and one called network-offline.png. Using the iOS app, I have found that this only uses png icons, not svg icons. These icons go in /conf/icons/classi…
Thank you, but this is not the problem we described above. There is no problem with icons or the naming of them.
I recently proposed a fix that is now merged but not yet in the nightly snapshots. It should fix this issue.
I have done a new ESH stable build and a new openHAB distro - so the
latest build should have the fix included.
Should this work now? I’m at the latest build and it doesn’t work as intended. I think that it worked with some of the last few builds.
It looks ok for me with build 937 and my contact items with mapping.
This is kind of a hop on - hop off thing. It always works in the Android App and Edge, it only sometimes works with firefox. That’s strange, but at least it works sometimes
I narrowed the problem down to the following:
if I update any item file Basic UI won’t react as usual anymore. Variables won’t get updated, visibility won’t get toggled and so on. Changes are only visible after reloading the page. This was mentioned before: https://github.com/openhab/openhab.android/issues/35#issuecomment-125887725
It starts working again without any problems after restarting Openhab.
Edit: Changing sitemaps also seems to break the stream.
You have apparently identified a clear bug with Basic UI when refreshing files. Can you open an issue in Git ?