Test switch status and loop X times then


#1

1) Give a description of the problem
Test switch status and loop X times to make sure its really off then execute switch off/on

2) What is the expected behaviour?
I want to test a switch status and make sure it’s really off after 1 minute then execute the on/off

3) What is happening/not happening?
I can’t get the logic to do the loop

**4) Post a Green Snapshot of the piston


#2

This piston has no precise triggers…
…so all of your vague conditions are acting like triggers.

This means that the piston will only execute when one of the three lightning bolt lines changes.


#3

I know that… what I don’t get is how to create the loop I need to validate the IF before it runs the ELSE


#4

I am confused. There is no ELSE in your piston
(which you probably do not want with three pseudo-triggers)


#5

THEN i meant


#6

Ok, cool. How about something like this?

IF Triggers...
THEN
   With Keypad  (TCP = Never)
      Send PUSH
      Turn off
      Wait 5 seconds
         IF Keypad is off
         Then
            With Keypad
            Turn on
         ELSE
            Send PUSH that there is an error
         END IF
END IF

(notice one IF is inside the other)


#7

That’s close…

If 
  Loop start
      HE Ping switch is off
  Loop for 2 minutes
  If switch is still off
Then
  Turn switch off
  Wait 2 seconds
  Turn switch on

This is what I want to accomplish


#8

I do not fully understand your goals, but here is a slight variation:

IF Triggers...
THEN
   With PingSwitch (TCP = Never)
      Turn off
      Wait 2 minutes
         IF PingSwitch is off
         Then
            With PingSwitch 
            Turn on
         END IF
END IF

(I dropped your “Turn Off” because it makes no sense to turn off a device that is already off)


#9

That’s it… that’s what I want…


#10

Dumb question, but do you have other automation that is supposed to automatically turn on the PingSwitch? (because there is no on command here until after the wait)


#11

In the original screenshot I do… turn off wait 3 seconds turn on


#12

OK. Here is that extra bit included:

IF Triggers...
THEN
   With PingSwitch (TCP = Never)
      Turn off
      Wait 3 seconds
      Turn on
      Wait 2 minutes
         IF PingSwitch is off
         Then
            With PingSwitch 
            Turn on
         END IF
END IF

#13

Yup that’s it…