Jump to content

competing commands


TheWabit

Recommended Posts

Posted

I have 2 programs for the same light/switch/MS setup. During a 1 hour period of time, they look like they can fight each other. My question is in the scenarios below, what likely will be the outcome of "closet on anytime" happening between 530 and 630? In other words, which one will win and why? 

 

Morning Closet Entry

 

If
        On Mon, Tue, Wed, Thu, Fri
        From     5:30:00AM
        To       6:30:00AM (same day)
    And (
             Control 'Master Closet MS - Sensor' is switched On
         And Status  'Margies Closet Light' is Off
        )
 
Then
        Run Program 'Closet MS Disable' (Then Path)
 
Else
   - No Actions - (To add one, press 'Action')

 

Closet MS Disable

 

If
   - No Conditions - (To add one, press 'Schedule' or 'Condition')
 
Then
        Disable Program 'Morning Closet Entry'
        Set 'Margies Closet Light' 40%
        Wait  5 seconds
        Set Scene 'Master Closet Light' On
        Enable Program 'Morning Closet Entry'
 
Else
   - No Actions - (To add one, press 'Action')
 

 

Closet on Anytime

 

If
        Control 'Master Closet MS - Sensor' is switched On
 
Then
        Set 'Margies Closet Light' 100%
        Wait  5 minutes
        Set Scene 'Master Closet Light' Off
 
Else
   - No Actions - (To add one, press 'Action')
 

 

 

 

Posted

Both Programs can Run and at the same time.  Not a matter of one or the other.  Once 'Margies Closet Light' is not Off the Status check in the first Program would stop it from being True.

Posted

Thanks Lee

 

I guess the way I looked at it is say it is 5:45 and she walks in. I want it to initially go to 40% (so that the light is no intense that early). The "if" items are true in both programs. I just didn't want it go to 100%.

Posted

The first program construct strikes me as a little strange.  Let's assume that this program is triggered by one of your conditions and is evaluated as TRUE.  This triggers execution of the "disable" program.  The disable program initially disables the first program, then turns on a light which would, if the first program is not disabled, retrigger the first program.  Has this actually been an effective strategy for you?  (I would not be certain how quickly these commands become effective and whether the program would be disabled quick enough.)

 

I would have taken a slightly different approach...

 

Morning Closet Entry

 

If
        On Mon, Tue, Wed, Thu, Fri
        From     5:30:00AM
        To       6:30:00AM (same day)
    And (
             Control 'Master Closet MS - Sensor' is switched On   <<<<Note removal of closet light condition
        )
 
Then
        Run Program 'Closet MS Disable' (IF Path)  <<<note change of path
 
Else
   - No Actions - (To add one, press 'Action')

 

 

Closet MS Disable  <<<<DISABLE THIS PROGRAM PERMANENTLY

 

If
   - Status  'Margies Closet Light' is Off
 
Then
                Set 'Margies Closet Light' 40%
        Wait  5 seconds
        Set Scene 'Master Closet Light' On
       
 
Else
   - No Actions - (To add one, press 'Action')

 

 

Of course, none of this addresses the fact that you have two programs, triggered by the motion sensor, telling the closet light to do two things at once.

 

To address this concern, what about something like

 

if

control motion sensor is switched on

then

run next program (if path)

else

nothing

 

next program

if

time is from 0530 to 0630

then

Run Program 'Closet MS Disable' (IF Path)

else

run closet on anytime (then path)

 

Modify closet on anytime to remove IF condition and disable.  No changes to disable program are necessary.

Posted

Great! When starting to program this closet and split the programs - I was probably focused on (what you guys in this forum have taught me) separating programs to prevent a status change from making a loop. Then I keep wanting to satisfy other living conditions and added more programs, That's when it got muddy!

 

Took me awhile to digest the above suggestions and it looks MUCH cleaner. These programs have been working fine but the disabling probably slowed things down. I will make the changes tonight. Thanks!

Posted

Using a slower ramp On for one situation and Fast On for another works for me in some situations. Easier on the eyes. The Fast On overrides the ramp speed anyway.

Posted

oberkc - I knew there was a reason

 

The first program construct strikes me as a little strange.  Let's assume that this program is triggered by one of your conditions and is evaluated as TRUE.  This triggers execution of the "disable" program.  The disable program initially disables the first program, then turns on a light which would, if the first program is not disabled, retrigger the first program.  Has this actually been an effective strategy for you?  (I would not be certain how quickly these commands become effective and whether the program would be disabled quick enough.)

 

I would have taken a slightly different approach...

 

Morning Closet Entry

 

If
        On Mon, Tue, Wed, Thu, Fri
        From     5:30:00AM
        To       6:30:00AM (same day)
    And (
             Control 'Master Closet MS - Sensor' is switched On   <<<<Note removal of closet light condition
        )
 
Then
        Run Program 'Closet MS Disable' (IF Path)  <<<note change of path
 
Else
   - No Actions - (To add one, press 'Action')

 

 

Closet MS Disable  <<<<DISABLE THIS PROGRAM PERMANENTLY

 

If
   - Status  'Margies Closet Light' is Off
 
Then
                Set 'Margies Closet Light' 40%
        Wait  5 seconds
        Set Scene 'Master Closet Light' On
       
 
Else
   - No Actions - (To add one, press 'Action')

 

 

Of course, none of this addresses the fact that you have two programs, triggered by the motion sensor, telling the closet light to do two things at once.

 

To address this concern, what about something like

 

if

control motion sensor is switched on

then

run next program (if path)

else

nothing

 

next program

if

time is from 0530 to 0630

then

Run Program 'Closet MS Disable' (IF Path)

else

run closet on anytime (then path)

 

Modify closet on anytime to remove IF condition and disable.  No changes to disable program are necessary.

oberkc - I knew there was a reason I had the light condition included but couldn't think of it when I responded to you. Now I remembered. Adding "status light is off" in the "if" took care of the MS sensing her leaving the room as she is shutting off the light (there is a reason she shuts it off with the switch that early in the morning) and turning it back on. I have about a 10 sec ramp rate so that gives time to switch the light off and leave while still not meeting the condition of light off.

Posted

That is fine.  Just add that condition (AND) into the program I called "next program".  Those suggestions were just concepts...tweak as you wish.

 

The bigger point of this logic approach was to propose a method to avoid having two programs triggered simultaneously, sending conflicting commands to a device.

Posted (edited)

oberkc - Let me start with this question. You show about the middle of your response to permanently disable "Closet MS Disable". But then toward the bottom you include that same program in your "Next Program". What I am running into right of the bat is the the light wont go below 40%. I can usually figure something easy like that out but not this time. Here are the programs I have so far:

 

Initiating Program

If
        Control 'Master Closet MS - Sensor' is switched On
 
Then
        Run Program 'Margie Closet Morning' (If)
 
Else
   - No Actions - (To add one, press 'Action')

 

Margie Closet Morning

If
        On Mon, Tue, Wed, Thu, Fri
        From     5:30:00AM
        To       6:30:00AM (same day)
 
Then
        Run Program 'Closet Morning Ramp Up' (If)
 
Else
        Run Program 'Closet Anytime On' (Then Path)

 

Closet Morning Ramp Up

If
        Status  'Margies Closet Light' is Off
 
Then
        Set 'Margies Closet Light' 40%
        Wait  5 seconds
        Set Scene 'Master Closet Light' On
 
Else
   - No Actions - (To add one, press 'Action')

 

Closet Anytime On

If
        Control 'Master Closet MS - Sensor' is switched On
 
Then
        Set 'Margies Closet Light' 100%
        Wait  5 minutes
        Set Scene 'Master Closet Light' Off
 
Else
   - No Actions - (To add one, press 'Action')
 


Looks like maybe the Closet Morning Ramp Up is True as soon as the light is turned off and triggers the "then". Status changes, it re-checks the "If" - It is now false and runs "else". ??

 

Edited by TheWabit
Posted
You show about the middle of your response to permanently disable "Closet MS Disable".

 

Yes.  When a program is "disabled", it does not mean that it will not run when called from another program...only that it will not self-initiate from its own conditions.  I did (and do not) want that program to be triggered by it's own conditions.

 

In your set of programs, the ONLY thing that you want to initiate some sort of action is the motion sensors.  Everything else should be initiated exclusively from other programs.  So...given your programs, I would disable ALL but the first.  Furthermore, I don't think you need a condition in "closet anytime on".

 

What I suspect is happening in yours is that some of the ELSE paths are triggering the parent program, halting any WAIT state.

Posted

Our responses crossed in the mail.  I agree, the IF condition in the "anytime" program is a potential problem, especially if the program is not disabled.

Posted

Worked great that time. Learned something about the disabled programs. If disabled, thought they wouldnt do anything even if called on by other programs. I also assume that if you call a certain path that it just starts that path and continues "down" running everything below it?? It doesnt just run the one call I assume.

 

I have also pretty much ignored the "Else" because it is hardly used (that I have seen). This one is a good example of how it can be used effectively.

 

I will let you know how it goes for the morning closet ramp up.

 

Thanks again!

Posted
I also assume that if you call a certain path that it just starts that path and continues "down" running everything below it?? It doesnt just run the one call I assume.

 

Yes, indeed.  Disable simply deactivates the self trigger.  If another program calls the IF condition, the condition will be evaluated and send it down the next path, based on whether true or false.

 

Other than the lack of a self trigger, a disabled program will behave normally.

Posted

1 Other question -

 

As long as motion is sensed the light will stay on correct? I assume it sends it back to the "Initiating Program" and starts over.

Posted

Yes.  Every time motion is sensed, it will initiate something. 

 

In your case, however, the morning program first turns on one light at 40%, then turns a scene ON.  So, margies closet light will go to 40% each time motion is sensed.  Unfortunately, I don't recall whether that closet light is part of the bigger scene, so I don't know if that is a noticable change in ON level for margies closet light.

Posted

oberkc - Everything seems to be working great. I just had to add another program to have the light turn off at 6:31. (She has gotten used to just walking in and out not touching the switch and counting on the MS and 5 min timer in the program to take care of it).

Thanks again!

Posted

Yes. I noticed that you did no have any automatic light shutoff when triggered on weekday mornings. Rather than adding a new program, why not simply put a 5 minute timer in the morning ramp up program?

Posted

So if I do that, and every time the MS "re-triggers", will it go back to the "Initiating Program"? If so, when it gets to the "Ramp Up" program, the "if" will be false and it will run the Else (which is blank so nothing would happen. Any or all of this correct?

Posted

So if I do that, and every time the MS "re-triggers", will it go back to the "Initiating Program"? If so, when it gets to the "Ramp Up" program, the "if" will be false and it will run the Else (which is blank so nothing would happen. Any or all of this correct?

Yes, good point.  I missed that.

 

So your program, as is, with the shutoff program at 6:31, will simply leave the lights on for 1/2 hour at most.  No big deal.

Guest
This topic is now closed to further replies.

×
×
  • Create New...