Jump to content

Allow program to test if another program is running


MrWorf

Recommended Posts

Posted

Hi,

 

In quite a few places I end up needing to know if a program is running or not. This can be accomplished with setting a variable on enter and exit of a program, but it would be great if the "Program" category on "If" would have two more options:

 

"is running" and "is not running" on top of the capability of testing the if statement. Should be a minor change I would think?

 

Thanks

Posted

Uhm, yes, but my program is unable to see the color since it's not human. I want to programatically test if a program is running or not.

 

Use cases for this is when I would end up with conflicting programs running at the same time.

 

"But you can just run stop anyway" I hear you think...

 

Yes, but there are some use cases where this is bad. For example, if program A messes with lights 1 & 2, program B messes with lights 2 & 3. If program C runs stop on program A and then proceeds to turn off lights 1 & 2, it will work most of the time, except when program A wasn't running but program B was. In that scenario, program C should do nothing since program A isn't running.

 

I hope that makes some sense, hard to explain :)

Posted

Uhm, yes, but my program is unable to see the color since it's not human. I want to programatically test if a program is running or not.

Ah understood! I misread the initial reply as a visual indicator was needed.

 

 

Encrypted By: Phoenix Security Solutions

Posted

Hi,

 

In quite a few places I end up needing to know if a program is running or not. This can be accomplished with setting a variable on enter and exit of a program, but it would be great if the "Program" category on "If" would have two more options:

 

"is running" and "is not running" on top of the capability of testing the if statement. Should be a minor change I would think?

 

Thanks

Yes, that would be useful for me too.

 

Benoit

Posted

Hi,

 

In quite a few places I end up needing to know if a program is running or not. This can be accomplished with setting a variable on enter and exit of a program, but it would be great if the "Program" category on "If" would have two more options:

 

"is running" and "is not running" on top of the capability of testing the if statement. Should be a minor change I would think?

 

Thanks

 

This is actually a little trickier.  Since ISY aborts a running program when "wait" or "repeat" is running without exiting through the final command.  You would need to be sure to include something in both the else and then clause for this to work.

 

IF

whatever

Then

Set $running 1

then stuff

Set $running 0

Else

Set $running 2 (or 1 if you don't care to tell the difference between then and else running) (only needed if there is a "stuff" in the else clause)

else stuff  (optional)

Set $running 0 (may be the only line if there is no "stuff" in else)

Posted

Actually, this is how you do it:

 

Program A

IF X THEN

   running = 1

   do stuff

   running = 0

ELSE

   running = 1

   do stuff

   running = 0

 

 

Program B

IF running = 1

   Stop Program A

   running = 0

   do other stuff

 

But we're diverging from the request which is to get this kind of support built-in into ISY which I think Michael Kohanim acknowledged :)

Posted

Actually, this is how you do it:

 

Program A

IF X THEN

   running = 1

   do stuff

   running = 0

ELSE

   running = 1

   do stuff

   running = 0

 

 

Program B

IF running = 1

   Stop Program A

   running = 0

   do other stuff

 

But we're diverging from the request which is to get this kind of support built-in into ISY which I think Michael Kohanim acknowledged :)

 

 

Assuming $running is a state variable, then your program B would render Program A useless should it include any "waits" or "repeats".  Program A would be stopped (either then or else) almost instantly upon trigger.

Posted

Just came in here to post the same request. Came across a situation where I didn't want to re-enter a program twice and it would have been nice to test to see if it was already running rather than using a variable set and reset on entry and exit.

  • 1 month later...
Posted

Hello all,

 

Can you explain to me what "running" refers to? In short, if there are no wait or repeat statements in the Then, running takes a few milliseconds (in ISY vernacular) and I am not entirely certain of its usefulness.

 

With kind regards,

Michel

Posted

I have several programs that normally always run. This is an example where I count how long something has been OFF

 

If
        Status  'Devices / EZIO8SA / Relay1-FillPump-BigTank / Sensor3-pressure-PressureSwit' is Off
 
Then
        Wait  5 seconds
        $Water_Minutes_PressurePump_VLD_off  = 0
        Repeat Every  1 minute
           $Water_Minutes_PressurePump_VLD_off += 1
 
Else
   - No Actions - (To add one, press 'Action')
 -----------------------------------

 

 

This is an other (unfortunate) example of where I query my EZIO8SA on a regular basis because it is unwilling/unable (maybe/probably due to my ignorance) to report its state.

Without this program running, my ISY would not know what is happening and my ISY programs would not run. So being able to test is this program is running would be great.

 

If
        Status  'Devices / EZIO8SA / EZIO8SA-power' is Responding
    And Status  'Devices / EZIO8SA / EZIO8SA-power' is On
 
Then
        Repeat Every  15 seconds
           Set 'Devices / EZIO8SA / Relay1-FillPump-BigTank' Query
           Run Program 'Water-Monitor_FillPump_shutdown2' (If)
           Run Program 'Water-Monitor_FillValve_shutdown2' (If)
           Run Program 'Water-Monitor_PressurePump_shutdown2' (If)
           Run Program 'Water-Monitor_12VDC_power_shutdown2' (If)
 
Else
   - No Actions - (To add one, press 'Action')
 
Query the EZIO8SA regularly to fetch the state of the sensors and relays.
Only do that when the EZIO8SA has power.
 

----------------------------

 

 

Hope this helps motivating this.

 

Bert
 

Posted

Hi Bert,

 

Unfortunately not! You see, your second program (the one that queries EZIO) is ALWAYS running: it's in a repeat loop and it does not stop running unless EZIO is not responding or has no power. So, the only thing that "is running" would provide to you is that the condition has turned false in which case you can either have the same conditions in your first program OR check whether or not this program is true.

 

With kind regards,

Michel

Posted

Bert,

 

 

If it were me, and I wanted to know when that second program stopped running, I would put a "notify" in the else clause so it could send me a text or email.

 

Of course, as Michel stated since the "then" is an endless loop, any time it is true, it must be running.  In this case "true" = "running" (short of some other program sending a "stop" or "disable" command.)

  • 1 year later...
Posted

+1 for this. 

 

I have a series of programs that make my deck lights cascade on/off in sequence with 1 second delays. It gets messed up when someone turns the light on and then turns it off before the program has finished (this happens when someone hits the wrong switch by the door).

  • 7 months later...
Posted

+1.

 

My use case: I have few programs that kill whole house fans and the AC due to indoor-outdoor temp difference.

 

In some cases, even if the temp difference dictates a certain state, my wife would like to override the system, so a kill program would wait 4-6 hours before it goes and kills again.

 

I had some cases where a program stopped for some reason (bug? reboot?), leaving variables in wrong state. an indication if a program is running will take away the dependency on variables.

  • 1 month later...
Posted

I thought on the Program, Summary tab, the "status" True, False told you of the program was running?

 

Yes, but I want to use that information inside of another program (see first post)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...