Java Runtime Environment: OH runs in a docker environment, so not sure.
openHAB version: 2.5.10
Issue of the topic: If a switch is being defined in the sitemap and it is based upon a mqtt thing, it shows both: the switch as well as text.
Dear readers,
I have defined a MQTT thing to subscribe (and publish) on MQTT. This is working fine (binding is up since it can read and changes when a change is posted onto MQTT and when changed in OH is is being posted towards MQTT).
However: when I restart OH the switch only shows the switch name and the switches next to it (as it is supposed to). After the switch has been used, it also shows the state next to the switch. This only occurs when it concerns a MQTT item.
When you restart openHAB or reload a .items file, all your Items are initialized to the special state NULL. Only when the Item gets an update (in this case receives a message after starting up) does the Item change state away from NULL. NULL and another special state UNDEF are represented on the sitemap as -.
You either need to configure the device that is sending the message to use a retained message (retained messages stay on the topic so when OH comes back up and resubscribes to the topic the old message is delivered) or configure persitence with restoreOnStartup in which case OH will load the most recently saved state of the Item from a database and update the Item with that at startup.
I know: retain can be defined within MQTT or a ‘refresh on startup’ in OH, but that is not the issue. I wonder how to remove ‘ON’ next to ‘OFF’. The switch is defined to show only the ‘OFF’ button, but it also shows the actual state. If possible, I would like to show only the button (like in a normal definition, only the button is vissible and not the actual state).
Oh, that. I think if you define an empty state formatting string in the label it will be removed. Though if I recall, there were some instances where that didn’t work correctly.
Switch Evohome_WoonkamerFastOff “Evohome Woonkamer Off []”
Bindings are able to provide hints to the way that Items get displayed in sitemaps. That is probably happening here.