Hi,
when taking a look at the location cards
one can find those awesome summary statistics like “lights in state on” etc.
If I am not mistaken those things are called badges
:
I am currently trying to build a custom widget myself and I was wondering how this data could be retrieved.
So far I was not able to find anything related but then I am also not really sure what to search for exactly.
Maybe someone can help?
Platform information:
OS: ArchLinux
openHAB version: 3.0.0-2
Take a look at this thread
There is an example how to get the badges configured
Thank you for that link!
In those examples all items are explicitly stated.
E.g. =((items.FGDW002WindowSensor_Open.state === 'OPEN' ? 1 : 0) + (items.HS1DSZDoorSensor_DoorSensor.state === 'OPEN' ? 1 : 0)).toString()
I was rather looking for something more generic where I simply configure a group name and probably the state I am looking for.
something like groupName.members[state == 'OPEN'].count
.
Does something like this exist?
Found a very similar question which is open since 14 days:
In openHAB2 it was possible to add %d to the aggregate group function:
Group:Switch:OR(ON, OFF) Lights_Outdoor “Lichter Aussen [(%d)]”
To have the same in OH3 label card I don’t know yet
Without luck yet.
I guess you can make a rule that gets the count and put it in a visual item, and then display that item state in the badge, might work?
Yes, I already did that but I thought it could done “easier”. If I can prevent creating that much dummy items I’d rather do so
I was wondering how the “badge” thingy is tretrieving that counter and would rather re-use that method if possible.