Need some additional logic help

I am working on automating my house fan switches so that when two or more windows/doors are open, one of the two (HFLow) HF switches turns on. And when 4 or more are open, the second HF switch (HFHigh) turns on. I have all this logic, along with if the HF switches are on and NO windows or doors are open. What I need some logic assistance on is if I start closing down my windows I would like the HF’s to start stepping themselves down too. Is the best option to reverse all my logic with NOTs?

[code]Triggers:
t_HFvSwOn - When the vSwitch turns on (Manual scene in Vera raises my roller shades and turns on this vSW)
t_HFsw1On - When HF Switch1 turns on
t_HFsw2On - When HF Switch2 turns on
(All my window/door sensors - too many to list)

Conditions:
c_HFLowOn = When 2 or more windows are open
t_HFvSwOn AND (t_bDoorOpen + t_fDoorOpen + t_Window1Open + t_Window2Open + t_LWindow3Open + t_Window4Open + t_Window5Open ) > 1

c_HFHighOn = When 4 or more windows are open
t_HFvSwOn AND (t_bDoorOpen + t_fDoorOpen + t_Window1Open + t_Window2Open + t_LWindow3Open + t_Window4Open + t_Window5Open ) > 3

c_HFOnNoWindow = When no windows are open
(!t_HouseFanvSwOn) OR (c_allSensorClose AND (t_HFsw1On OR t_HFsw2On))

Logic Actions:
c_HFLowOn = Turn on HF Sw1
c_HFHighOn = Turn on HF Sw2
c_HFOnNoWindow = Turn of HF Sw1 & Sw2[/code]

Please use a status report in the future.
I would create an intermediate condition … to save on some typing.

cWindowsOpen t_bDoorOpen + t_fDoorOpen + t_Window1Open + t_Window2Open + t_LWindow3Open + t_Window4Open + t_Window5Open
Stateg1On cWindowsOpen > 1
Stage2On cWindowsOpen > 3
Stage2Off cWindowsOpen < 4
Strage1Off CWindowsOpen < 2

Oh nice. I didn’t know that you could use the combination from a condition. Meaning Stage1On could be 1 or more from cWindowsOpen. That will simplify things a lot.

Would the following work as well?

cWindowsOpen t_bDoorOpen + t_fDoorOpen + t_Window1Open + t_Window2Open + t_LWindow3Open + t_Window4Open + t_Window5Open
Stateg1On cWindowsOpen > 1
Stage2On cWindowsOpen > 3
Stage2Off cWindowsOpen = 2
Strage1Off CWindowsOpen <= 0

Got it to work in my virtual testing arena. Thank you for the assistance. Below is the end result.

Triggers:
t_HFvswOn - Virtual HF Switch enabled by a scene / Echo controller
t_HFsw1On - Physical Switch on Fan1
t_HFsw2On - Physical Switch on Fan2

Conditions:
c_HFWinDoorSensors = t_bDoorOpen + t_fDoorOpen + t_Window1Open + t_Window2Open + t_Window3Open + t_Window4Open + t_Window5Open

c_HFLowOn = t_HFvSwOn and c_HFWinDoorSensors > 0

c_HFHighOn = t_HFvSwOn and c_HFWinDoorSensors > 2

c_HFHighOff = t_HFvSwOn and c_HFWinDoorSensors < 3

c_HFLowOff = t_HFvSwOn and c_HFWinDoorSensors < 1

c_HFOff = (t_HFsw1On OR t_HFsw2On) and c_HFWinDoorSensors < 1

Actions:
c_HFLowOn = Turns on Fan1
c_HFHighOn = Turns on Fan2
c_HFHighOff = Turns off Fan2
c_HFLowOff = Turns off Fan1 and vSwitch
c_HFOff = Turns off Fan1 and Fan2

The last condition c_HFOff is a catch in case either physical switch is turned on and there are no doors or windows open.

Again, thank you for the assistance. I’m open to feedback if there is a better way to do the above. Now I need to order two more switches.