Notify when piston is paused for too long


#1

Is there a way to get notified when a piston that is normally supposed to be constantly running gets paused for a set amount of time?

I have a 2 pistons that are supposed to pause when a lock jams in order to protect the lock. The pistons then resume when the lock is operational again. Is there a way to get notified when the pistons are paused for x amount of time? The pistons should never be paused for more than 5-10 min during normal operation.

Thanks


#2

There are many ways to tackle this… Some would use a global variable, but I would likely use a Simulated Switch… Maybe something structured like this. (most of which you likely already have coded):

CURRENT PISTON

IF lock jams
    Then Turn on SimSwitch   <-- New command
    Pause other two pistons
END IF

IF lock unjams
    Then Turn off SimSwitch  <-- New command
    Resume other two pistons
END IF

NEW PISTON

IF SimSwitch remains on for 10 minutes
    Send notification
END IF

Let us know if you need help creating a Simulated Switch


#3

I see so you are basically assigning the piston to the virtual switch, which can then act as any other switch…

That makes sense.

I know not of making virtual switches or variables but I am open to learning both. I’m pretty new.

What are the pros/cons of both?

My fate is in your hands @WCmore lol


#4

It is a matter of preference what method you employ… I just like the capabilities when using a SimSwitch instead of a global variable in a case like this.

It does take 2 minutes to create the SimSwitch, but the coding will be easier w/less troubleshooting, so the trade off is worth it, IMO


#5

Gotcha. Can you point me in the direction on how to create a virtual switch?


#6

A good step by step to create a Simulated Switch can be found here.

The only thing I would like to add to his steps is your “Device Network Id” should have no spaces or funky symbols


#7

I’ll check it out. Thank you for your help :slight_smile: