Show numbers of Group ON/OFF in mainUI

I’ve got an item that combine all my lights:

Group:Switch:OR(ON,OFF)   LightsWO   "Lichten Woning [(%d)]"   <light> 

This nicely works:

Switch  Light_WO_HalGang  "Gang"  <light>   (LightsALL, LightsWO)   { channel="knx:device:127f5b55:Light_WO_HalGang" }
Switch  Light_WO_Hal      "Hal"   <light>   (LightsALL, LightsWO)   { channel="knx:device:127f5b55:Light_WO_Hal" }
....

In my sitemap, this is nicely shown as button, and a nice effect was that I saw the number of lights that were ON.:

Switch item=LightsWO label="Woning" mappings=[OFF=Uit, ON=Aan]

Screenshot 2022-01-10 142115



MainUI

I’m trying now the same in the mainUI, but instead of the number, i just show me the status? Any idea how I can get the same effect as with the sitemap? I tried with state or displayState, but no luck. :blush:

component: oh-label-card
config:
  action: navigate
  actionGroupPopupItem: Woning
  actionModalConfig: {}
  actionPage: page:page_e5341df83c
  actionPageTransition: f7-push
  background: '=(items.LightsWO.state === "ON") ? "lightyellow" : ""'
  expandable: false
  header: Woning
  icon: oh:light
  item: LightsWO
  stateAsHeader: true
  subtitle: Verlichting
  title: Woning
  trendItem: LightsWO
  footer: ="Aantal " + items.LightsWO.state + " - " + items.LightsWO.displayState
slots: null

Screenshot 2022-01-10 142456

Sitemap UIs have a bit of magic, when the [%d] presentation is used they can display a Group count.
This feature has not been implemented in MainUI, other methods can be used

So I added a new item, and it works out of the box. :+1:

Just a bit worried that my items will belong to ‘10’ groups at the end, but when this is no issue, it’s a nice solution.

The items:

Group:Number:COUNT(ON)    LightsWO_ON    "Lichten Woning [(%s)]"  

Switch  Light_WO_Keuken     "Keuken"     <light>   (LightsALL, LightsWO, LightsWO_ON)   { channel="knx:device:127f5b55:Light_WO_Keuken" } 
Switch  Light_WO_Badkamer   "Badkamer"   <light>   (LightsALL, LightsWO, LightsWO_ON)   { channel="knx:device:127f5b55:Light_WO_Badkamer" } 
...



And the widget:

footer: ="Aantal " + items.LightsWO_ON.state

Screenshot 2022-01-11 125555

1 Like

I’ve done something similar using “SUM” instead of “Count” for my lights.
This here is much better, but I haven’t figured out yet how to create a group item with a count similar to the textual definition in MainUI. Maybe I did simply not find it or it is missing. Can somebody give a hint ?

Groups with count-function are not implemented in main UI yet, but you can use the “Add items from Textual Definition” function in the main ui (“Items” =>"+") and copy the text definition like so:

Group:Number:COUNT(ON)    LightsWO_ON    "Lichten Woning" 
2 Likes

Thanks, that was supposed to be my fallback.:wink:
Just thought i missed something important…