I think you probably need to think in terms of the virtual switch changing to on and off. I haven’t thought this through, but what about …
if
FanCirc's switch changes to on
then
with
Thermostat 1
do
set fan to on
end with
with
FanCirc
do
wait 120 minutes
turn off
end with
end if
if
FanCirc changes to off
then
with
Thermostat 1
do
resumeProgram()
end with
end if
When the virtual switch is turned on the fan is also turned on. After 120 minutes the virtual switch is turned off.
Whenever the virtual switch is turned off for any reason the previous program is resumed.
If the switch is turned off before the 120 minutes is up, the wait will be cancelled, which is what you want.
I think the reason you needed the ‘Never Cancel’ in your piston is because you are running the two actions asynchronously and have two timers running. When the piston wakes up and turns off the switch, that fires the piston again and that instance executes just before the other wake up timer and would be able to cancel it without the ‘Never Cancel’.