Jump to content

Toggling a program from the True to False and vice versa


Go to solution Solved by Javi,

Recommended Posts

Posted (edited)

@Javi what is the easiest way to have a tile in favorites when touched toggle between running the THEN and the ELSE. 

Currently my work around is to put in the IF statement: If <program> is false, and then disable the program, and have the favorite set up as a Command with the same program selected to run the IF. 

Below is an example of a sprinkler zone that I can turn on /off manually via a favorite. However I have other programs that the IF statement contains other items and it needs to stay enabled. This technique only works for a disabled program. 

Thanks!  Love the power of UDM!

 

Sprinkler Lake 1 LD - [ID 0166][Parent 0150][Not Enabled]

If
        Program 'Sprinkler Lake 1 LD' is False
 
Then
        Set 'Elk Controller and Outputs / Sprkl Lake 1' On
        $I_Sp_Counter  = $I_Sp1_Lake_1
        $I_Sp_Counter *= $I_Sp1_Percent
        $I_Sp_Counter /= 100
        Repeat While $I_Sp_Counter > 0
           Wait  1 minute 
           $I_Sp_Counter -= 1
        Repeat 1 times
           Run Program 'Sprinkler Lake 1 LD' (Else Path)
 
Else
        Set 'Elk Controller and Outputs / Sprkl Lake 1' Off
 

image.thumb.jpeg.9fae9245d5ba3a047a652f752a458384.jpeg                  image.thumb.jpeg.c185b81b01387e815e1b33c1311e28d0.jpeg

Edited by dbwarner5
added UDM screenshots
  • Solution
Posted

There is no real way to toggle a program, as the commands which handle running programs are runIf, runThen, runElse, and Stop.  UDM emulates the a program toggle by sending runIf (if not running) or sending stop (if running then/else).  So On is "running" and Off is "stopped".

As a work around an integer variable as boolean (0=false | 1=true) status can be created.  Enable the current program then set the variables boolean value in the then and else conditions. Create another disabled program which is triggered by UDM which has an if condition using the variable. The original program can still be used as the Display Status if needed.

  • Like 1
Posted

@javi.. thanks. in that case, I can actually just use my current method and have a 'trigger" program that simply runs the THEN or hte ELSE of the target program. no need to add more variables. 

Example:

Trigger program: Disabled. 

IF: If <trigger program> is False

Then: Run Target program Then

Else: Run Target program Else

 

Then set up the Trigger program as a Command, run IF. 

I think this would much easier. Just wanted to make sure I wasn't missing anything else. Thanks.

Guest
This topic is now closed to further replies.

×
×
  • Create New...