Trigger pump with heating circuits

Hello, I have following problem:
I have a house with 6 thermostat entities, which work great - 6 temp sensors and 6 relays triggering underfloor heating valves.
But, I also have a pump relay, which I want to trigger on when any of those 6 thermostats start heating but turn off, when ALL 6 thermostats are off.
Turning pump on with an automation is already done and works great.
But I can’t figure out elegant solution how to turn pump off.
I tried making gropus, but for some reason it doesn’t work with binary entity…
Help!

Groups most definitely work with binary sensors.

Share your attempted pump off automation, correctly formatted for the forum.

I have esphome relays, which are not sensors - cant add them to group

You can add switches and binary sensors to the same group if you use YAML.

Or you can forget the group and just use the entities directly in the automation.