Visual appearance of group items in sitemap / cast switch to text?

Hi to Everybody,

I´m working with openHAB2 for some weeks now, and for me it is a very powerful system.
There are some points, where I need some ideas how to proceed. The following example is used to show all Homematic devices which are battery powered. I added these devices to a group (gBatt). So I can react with some rules if any of these devices run out of power supply.
Item definition:

Group:Switch:OR(ON,OFF)     gBatt  "Status Batterie"

Switch Wohnzimmer_T1_Bat "Wohnzimmer Tür1"  <hm_batt>   (gBatt)
Switch Wohnzimmer_T2_Bat "Wohnzimmer Tür2"  <hm_batt>   (gBatt)

I also want to have a list in my sitemap containing these battery items. To be more flexible, I put the group into the sitemap, not the items themselves. So I can add more devices without changing the sitemap.
Sitemap definition:

Group item=gBatt icon="hm_batt"

This solution seems to work (never got the out of power state until now). But the sitemap shows the swichable icon on the right side of the shown item. If I put the items manually to the sitemap, I can change the type to “Text” instead of “Switch”. But the Group item always comes with the “Switch” type. If I change the items to “String” instead of “Switch” inside the item file, it is not working because the channel comes with the “Switch” type.
What can I do to hide the switch icon or how can I cast the switch type to an text type?
Would be very nice, if someone of you can point me into the right direction.
Thanks a lot.

This is a case where you can’t have your cake and eat it too.

  1. You can use Group in which case the way your Items are presented is the default for that Item Type.
  2. Or you can put each Item on the sitemap individually in which case you can use Text for the Switches and the toggle will not appear.
  3. A Third alternative is to create proxy Items for all of you battery Items which are String or Contact types, rules to keep those Items up to date when the “real” battery Switch Items change, and then put the proxy Items into your Group for display on your sitemap.

Personally, I’d say option 2 will be less work in the long run.

Of course there is secret option 4, ignore the toggles and continue on, and secret option 5, use Habpanel.

1 Like