Toggle Repeatedly If Condition is True


#1

Hello-

I have a piston that monitors the temperature and turns on a virtual switch at 73*. That virtual switch then turns on 2 fans. I would like to have a piston that will toggle one of those fans on and off indefinitely, as long as the virtual switch is on. What I have here only toggles twice. Any suggestions?


#2

Two options come to mind. I have not tested these.

IF Virtual Switch changes to on
  Then
    Repeat
      Toggle fan
    Until Virtual Switch is off
END IF

Or…

IF Virtual Switch changes to on
  Then
    While Virtual Switch is on
      Do
        Toggle fan
      END While
END IF

#3

I’m looking for this piston to toggle on and off repeatedly every 5 minutes. 5 minutes on, 5 minutes off, over and over as long as the virtual switch is on.


#4

Yes. Both will do that. Maybe I need a little clarity of my “Toggle fan” instruction.

Repeat
Turn fan on
Wait 5 minutes
Turn fan off
Wait 5 minutes
Until Virtual Switch is off

Or

While Virtual Switch is on
Turn fan on
Wait 5 minutes
Turn fan off
Wait 5 minutes
END While


#5

Gotcha! Where do I get the “Repeat”? 1st line??


#6

Top right, under Options, check Show advanced statements.

image


#7

Does this look like it would work?


#8

Possibly. Change your wait times to 30 seconds and see.


#9

It works! Thanks for the nudge in the right direction. I still can’t find repeat, but this gets it done.


#10

Glad to help…


#11

Webcore%20Green%20Check%20II