How to simulate "for each" loop without explicitly placing each entity?

Hello there
I have more like a “UI de-cluttering” question rather than complain.
I am trying to achieve following result:

  1. I have 10 thermostats for underfloor water heating and a boiler
  2. I want to check if ALL thermostats are reached target temperature or current temperature > target
  3. if ALL true → Heating Off else On
    Since I have 10 thermostats flow becomes actually very long both horizontally and vertically and “connectors” are dangling all around.
    Is there is anything that can represent a Boolean group?
    I tried app but it only has a When card and unfortunately I found no way to configure a Boolean output for ALL entities.
    Technically speaking I would like to have something like a virtual device etc. that will output
for thermostat in thermostats_group:
      if thermostat.target_temperature > thermostat.current_temperature:
          return False
      return True

So I can use this inverse logic device to check if any thermostat is in the heating mode and act accordingly.
My current approaches:


Thanks for any help!

One way to ‘de-clutter’ this would be to use homeyscript to loop through each thermostat and which could return a true/false to use in the flow

2 Likes

Yeah, probably most optimal solution
I tried to avoid using script since I have HA for that :slight_smile:
Would be great to have additional features someday in the future

Thanks

Have you testet the app <group>?

Or create a JSON with the values using JSON handler app. It then has a card to loop through all values.

2 Likes

Yes, group device provided only When card
And capabilities are either ‘mean, average’ etc
Found no way to create something like template sensor in HA

JSON app seems reasonable as well, thanks

Maybe also check Device capabilities app. It is very customable.

1 Like

You could also check out the VThermo app. I use it to create virtual thermostats. When you create a virtual thermostat, it has a lot of options to control its state based on other thermostats or thermometers. You can set its temperature to be an average, a minimum or a maximum of its child thermometers or other thermostats. This allows you to even make complex combinations.

1 Like