Jump to content

Programming "If" for ANY change to device status??


ccclapp

Recommended Posts

Hi

I cant seem to find the answer to what I imagine is an easy question:

 

I want my program to respond to ANY change to a device.  Is there an easier way than saying:

If
        Control (Old) 'Kit Hl D2 Din Hang' is switched On
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Off
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Fast On
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Fast Off
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Fade Up
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Fade Down
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Fade Stop
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Bright
     Or Control (Old) 'Kit Hl D2 Din Hang' is switched Dim
 
Then
   - No Actions - (To add one, press 'Action') 

In my case I want to trigger some things bases on ANY change to ANY light.  I will have to repeat the above for EVERY light and have a massively long program.

 

I had hoped "Is Responding" was the key, but now understand that has to do with communication with the PLM, not change of status.

 

Is there a simple way to do this?

 

Thanks

 

[EDIT:  Sorry, I meant to put this under Questions, not Tutorials section of the forum]

Link to comment

What you have written will respond to any ACTION taken AT the switch.  Not necessarily any change at the switch.  In other words, if the switch is changed because it is responding to a scene, your above program won't do anything.  Your program only responds to someone physically pushing the switch.  "Control" means that the switch was physically acted upon.

 

You need to use STATUS to trigger a program on any change.

 

If 

Status is on

or

status is not on

 

Then

do something

 

The above "do something" will run every time the light changes status.  "Status" programs always trigger on a change of status and the two lines of code combined with an "or" cover all possible states meaning that it will always be true and run the "then" clause.  Keep in mind that an action taken on the switch that doesn't change the status won't do anything, for example, if the light is already on and someone pushes the on paddle.

Link to comment

Thanks so much!

 

The wording is NOT intuitive.  I have always assumed status is a current state, not tht it picks up changes to the state.  Thus, with your program above, I thought that would always have a "true" status and thus be meaningless.

 

Also, because my device is a light controlled by a dimmer, it appears that there is no "On", but instead 1-99 dim levels, thus it would seem I need to have 100 conditions (99+ off)

 

Ignoring all the normal understanding of words, does your program still do it for ANY change of the light's state?

Link to comment

Thanks so much!

 

The wording is NOT intuitive.  I have always assumed status is a current state, not tht it picks up changes to the state.  Thus, with your program above, I thought that would always have a "true" status and thus be meaningless.

 

Also, because my device is a light controlled by a dimmer, it appears that there is no "On", but instead 1-99 dim levels, thus it would seem I need to have 100 conditions (99+ off)

 

Ignoring all the normal understanding of words, does your program still do it for ANY change of the light's state?

 

Status programs trigger on a change in status, the truth or false outcome depends on what status states you included.  Triggering just runs the program, whether it is true or false is a separate thing.

 

It makes zero difference what you put in your two connected "or" statements, as long as they are the same.  If status is 2% or status is not 2% will always be true just the same as any condition you put there.

Link to comment

Status programs trigger on a change in status, the truth or false outcome depends on what status states you included.  Triggering just runs the program, whether it is true or false is a separate thing.

 

It makes zero difference what you put in your two connected "or" statements, as long as they are the same.  If status is 2% or status is not 2% will always be true just the same as any condition you put there.

 

Thanks again.  Im trying to get this to sink in.  One thing I note now, is that you initially said "On" or "Not On".  You did not sat  "On" or "Off", which I mistakenly read, so my comment about the dimmer was not valid.

 

To your wider point, you are saying that "Status" is the current state of something vs "Control" which is the controlling device, e.g. a switch, physically being changed (or possibly being virtually changed via a program.  I forget if programs can do this to a switch).  I believe you are also saying the trigger is ALWAYS the CHANGE in Status.  Thus, as you said, regardless of something's current state, the trigger occurs when the state changes as long as the change is within the parameters of the IF statement.  Thus if the IF encompasses all possible states, ANY change will trigger the program.

 

Finally I believe you are saying, the trigger is not a question of whether the status of the device is true/false, only if a future change in state of the device will fall within the limits of the IF statement.

 

Do I have this conceptually correct now?

 

Thanks for your help

Link to comment

Control requires that the device be manually manipulated. The command is always sent even it the state of the device does not change. If the trigger is On, then the program will trigger every time On is pressed. If a command is sent from another device (e.g., scene), then the program will not trigger.

 

Status requires that the state of the device changes. It doesn't matter if you manually change the state or another device changes the state (e,g,. scene). The scene will not trigger if the state does not change.

Link to comment

Trigger in a status program is ANY CHANGE. . . .period.  The x in "if status x" is has no bearing on the fact that it triggered, it only affects whether the program is true or false (and thus a then or else runs).

 

If status of device is on

Then do x

Else do y

 

All changes in device trigger the program

If it changed to on, then x happens, otherwise y happens.

 

 

 

If control is switched on

Then do x

Else do y

 

All presses of on paddle trigger program.  Nothing else triggers this program and x is the only thing that happens, y would never happen as it is currently written.

Link to comment

Trigger in a status program is ANY CHANGE. . . .period.  The x in "if status x" is has no bearing on the fact that it triggered, it only affects whether the program is true or false (and thus a then or else runs).

 

If status of device is on

Then do x

Else do y

 

All changes in device trigger the program

If it changed to on, then x happens, otherwise y happens.

 

 

 

If control is switched on

Then do x

Else do y

 

All presses of on paddle trigger program.  Nothing else triggers this program and x is the only thing that happens, y would never happen as it is currently written.

 

Thanks.  This additional detail is very helpful!

I wish this was documented in the wiki or user-guide. 

I appreciate your clarity.

Link to comment

A common technique

 

If

control device x is switched on

and

control device x is not switched off

 

Then

do x

 

Else 

do y

 

 

Triggers

either pushing on or pushing off paddle

 

Result

pushing on runs then  (both lines are true, indeed the on was pressed and the off was not pressed)

pushing off runs else (both lines are false, though only one needs to be.  The on was not pressed, the off was pressed, (not not-pressed))

 

 

I believe this stuff is in the wiki.  Though it may not be organized as you expect.

 

YOU MUST STUDY ALL PROGRAMS IN TWO WAYS - -   TRIGGER AND RESULT

1) line by line as to what triggers

2) line by line as to what constitute the line being true vs false once triggered.

Link to comment

Archived

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


×
×
  • Create New...