Display the number of filtered groups items in a widget

hahah!

Thanks that works, not quite what I was looking for (it just prints the state but without the item name but thats OK) - basically wanted to know which item in the group was off, if it was off.

Could you please post the yaml code of the widget you want to use.
Mybe we can work around what you want to achieve by using a repeater for the footer….

It’s nothing fancy, I just wanted to know the item name of the item which is off in the group of only two items.

              - component: oh-label-cell
                config:
                  header: Miner Status
                  on: true
                  label: '=items.gMiners.state == "OFF" ? "OFF" : "ON"'
                  color: "=(items.gMiners.state === 'ON') ? 'green' : 'red'"
                  footer: =items.gMiners.state + items.gMiners.state

That should be simple, but untested, as I am not at my computer atm

footer: ‚= (items.miner1.state == OFF) ? items.miner.name + ‚ is Off‘ : (items.miner2.state == OFF) ? items.miner2.name + ‚is Off‘ : ‚‘ „

Sorry, but my iPad is not doing the hyphens right…
I can post a tested solution tomorrow, but you can already play with this with the expression checker I posted earlier…

1 Like

Thanks , throws up errors

I will post working solution tomorrow…

No stress, thank you!

As promised…

footer: ‘= ((items.GarageMinerAPresence_Online.state === "OFF") && (items. GarageMinerBPresence.state === "OFF")) ? "Both Miners are not running" : (items. GarageMinerAPresence.state === "OFF") ? "Garage Miner A is not running" : (items. GarageMinerBPresence.state === "OFF") ? "Garage Miner B is not running" : "Both Miners are running"‘
2 Likes

Perfection! Works like a treat :slight_smile: Thank you so very much hans!!!

Glad I could help :wink:

i am trying to find a way to display in a footer of a label-cell widget the number of lights that r ON and the number of lights that r OFF.All the lights are member of one group.Is there way to do it?