Constructing a rule - Need ideas

So Iā€™ve picked up a 10 pack of the iris contact sensors to use on my windows throughout my house.

The plan is to turn off my hvac if at least 2 of any of the windows are open.

How can I build a rule for this?

Something like this:

Create a local variable: local_count_var

trigger:
All contact triggers changed

rule:
set local_count_var to 0
if window 1 is open add 1 to local_count_var
repeat...
if window 10 is open add 1 to local_count_var
if local_count_var >1 then
Thermostat off
else
thermostat on
end if

Just asking to learn I am not very great at RM.

Couldn't you do all windows on 1 line?

rule:
set local_count_var to 0
if window 1; w2; w3; w4; ....... is open add 1 to local_count_var
if local_count_var >1 then
Thermostat off
else
thermostat on
end if

I don't think so as it doesn't loop through all of the contacts. If you try multiple contacts, it would show up as if any contacts open. And since you are looking for 2 being open, your stuck not knowing how many were open.

I vaguely remember that there is a 3rd party app that you can group these. You would probably be alittle easier on the processing power if you grouped them. you'd have to search, as I'm at work and cant search for it right now, there is a release that would help you with this.

it's somewhere in this thread. Probably towards the end

you could always daisychain If thens