Read only for device switches

I need to show a “read only” version of a switch, like

Switch	DeviceExample	"My device"	<network>	(G_Device)	{ channel="network:device:somedevice:online" }

I know that I can represent it in the sitemap as

Text item=DeviceExample label="Device is [MAP(]"

where does the conversion to text of ON and OFF, but in my sitemap I want to show the full group G_Device, so it is not practical to manually put in the sitemap the text version for all the devices.

Do you think there is a better way to do so (on openhab2, currently the stable release)?

This is very helpful to monitor the state of some devices (like smartphones and tablets) which do not need to be controllled by an active switch.

Thank you,


As far as I know you cant changed the default representation of an item tyoe.

Have you thought about using a contact item type for your use case? If you never wanna switch it manually but just represent a binary state this can be a solution.


Good idea, I didn’t think about that. Though, it seems it does not work as this is based on “open/close” while the network device has “on/off”. Does that make sense?


According to the docs you are right and the network binding needs a switch type item. Just gave it a short try on my OH2.1 based test system and unfortunately it doesn’t work with Contact :frowning_face:

Sorry, I think you have to go the long way and define each switch manually as Text in the sitemap.

Yes, thanks…
I’m doing it, but I think this should be considered, maybe by adding an option to the switch type in the channel configuration, or something.
It would be helpful…

Second this. It seems odd to be able to toggle the presence of a smartphone, for instance, when it’s a inherently read-only property.

@potyt are you trying something similar to the Op?

I think rules may work? Let me know I had an idea to try.

You can make it read only by defniing it as a text item in the sitemap. Simple as that.
Then only the binding and rules can manipulate the item.
Just to remind you that sitemaps are mainly for that purpose, monitoring.
If you use the sitemap to control everything what you have in the end is a glorified remote controller.
Out of my 500+ items I only have about 10 that I can actively change on the sitemap and then only every so often or because there is no other way to control the device.