Hide a switch from the sitemap

Dear all!

I have a stupid question: I have a group of switch items in which I want to display the inidvidual switch items in the sitemap without their switches, because I want to provide the state information only without giving the user the possibility to set the state (because that is really not possible). Can that be done?

context: I have a group containing 8 smoke detectors. The state of the detectors is given as “switch” type in the homematic-binding. So the items of the detectors are defined as switches.
Switch SmokeDetecorRoomX (smokedetectors) {binding=homematic…}
I grouped the detectors together in a group item
Group:Switch:OR(ON,OFF) smokedetectors
to present them in the sitemap as
Group item=smokedetectors icon=“fire”

It works very nicely: as long as all detectors are OFF, the symbol of hte group is gray, if one detector is ON the symbol of the group bcomes red. veeery nice. Also, when I open the group, detectors are displayed with a red or grey icon, depending on their state. Veeeery nice.

BUT: besides the 8 smoke detectors the classical UI and the UI on the smartphone presents me with a swich which the user may press to change the state of the item in openhab. I would like to supress the possibility to change the state of the smoke detector in openHAB, because that really makes no sense. (either hide the switch or ignore pressing them). Also, I want to avoid users to set the state of a smoke detector to ON, because that would trigger notifications to all users. (it would not make a smoke detector sound an alarm in real life, because I would have to sendCommand to the detector in a rule, which I don’t do)

thanx for support,
Sulla

I think you can specify it in the sitemap as type Text.

The basic situation (don’t use a Group sitemap widget)

More elegant approach, with Group like visual behaviour

I’ll try that!

OK, that works well with the TEXT definition in the sitemap! Very nice, thanks a lot!

How do you specify the icon for your Item ?

When you allow the Group widget to display an Item, it uses a Default widget which includes default icons and default actuator switch-slider thingy.

You decided you didn’t want that, so now if you don’t like the default icon for a Text widget, then you must specify the icon you want. You can do that in the Item itself, or you can do it in the sitemap line.

I use the definition
Group item=smokedetectors icon=“fire”
which automatically uses a gray flame when the state of the group = OFF and a red flame when the status of the group is ON.

The new solution
Text item=smokedetectors icon=“fire” {
Text item=SmokeDetectoirRoomX icon=“fire”
}
does the same.

Its just the icons of the individual SmokeDetecorRoomX is always a red flame. Can I make that icon depend on the state of the item as well?

all right, if i just leave out the final icon=“fire” then it works:
Text item=smokedetectors icon=“fire” {
Text item=SmokeDetectorRoomX
}
works like a charm! Thanks a lot!!!

All right, there might be a bug there:
In the definiton in the Text-Box in the sitemap
Text item=SmokeDetectorRoomX
at first openHAB always displays a red flame symbol. But when I once set the state manually to ON and then again to OFF, the symbol changes to grey in sate = OFF and red in state ON.
After a reboot everything is ok, so it really was a one-time necessity.

I don’t what that means. If you edit the sitemap, you’ll need to refresh your browser for effect.

No, that is not the reason for this “bug”. When I update the sitemap, then of course I need to refresh the browser. (note that the mobile phone app doesn’t need a refresh, it loads the new sitemap automatically).

The small “bug” is that when I change the icon of the Group or the Text in the sitemap or or if I change the icon of a group or an item in the x.item file (e.g. from “smoke” to “fire”), openhab would display a red flame in the UI, even though the status of the item is OFF, both in the browser and in the mobile app. When I once change the status from OFF ==> ON ==> OFF, the flame in the state OFF is now grey as it should and follows the state of the switch-item.

This behaviour contributed a little bit to the confusion / misconception I had about symbols not corresponding to the state of the switch-item.

Having investigated a bit, I reckon it might just be that after a reload of the item definition the switch-items are in an undefined state and thus the red flame symbol.
Anyway, thanks a lof for your help, all of you!

It probably helps to understand the icon set you are using.
Every icon set has a “root” or default image
I guess this flame you are one about is the default “fire” set, comprising
fire
fire-on
fire-off
If an Item state is ON or OFF you get the appropriate image. If it’s anything else - like NULL, which all Items start life as, you get the default.
The assembler of this particular set decided that the default would be the same image as -on version.

Hover over images to see filenames -
https://docs.openhab.org/v2.1/addons/iconsets/classic/readme.html