Jump to content

Can't even get the basics to work! Help.


jdbaker

Recommended Posts

Just starting the conversion from TimeCommander to ISY.

 

I'm starting with a simple program to turn on front spot lights when one of two outdoor PIR's is tripped.

 

PIR's are in the "ON" state until tripped.

 

Here's what the code looks like:

 

If

Status 'PIR Chimey" is Off

or Status 'PIR Garage" is Off

 

Then

Set Scene 'Front Spots 3Way' On

Wait 5 Seconds

Set Scene 'Front Spots 3Way' Off

 

Else

No Actions

 

When the PIR trips, the garage spot goes on but the Off command is never issued. Even after the PIR returns and remains in the 'On' state.

 

Could this be because the PIR is returning to the 'On' state before the timer is expired?

 

Thanks.

 

J.D.

Link to comment
Could this be because the PIR is returning to the 'On' state before the timer is expired?

 

That is my guess, but 5 seconds seems to be a pretty short time. How long do you expect your PIR to stay off once motion is detected? If you are unsure, you can watch an event viewer to get a little more insight into the timing of everything.

 

As a possible option, you might try changing 'status' to 'control'

Link to comment

Probably the reason that this didn't work the first time is because of the concept of triggers.

 

In ISY, a trigger is something that causes the If section to be evaluated. When the If section is evaluated it will restart the program.

 

"Status" is a trigger every time the status of that device changes, regardless of what the status changes is (on to off, off to on, partial on to some other partial on, etc). So, the motion detector is tripped, it becomes "off", this starts the program. But, since the motion dectector switches back to "on" when no further motion ocurrs, the program restarts when the motion stops long enough for the motion detector to switch back to "on" status. This time however, the if section is no longer true (because this change was to the "on" state) so the else section is exectued, which you had empty. Since the program was interupted prior to the delay you wrote in, it never finished the then section. If you stood in front of the motion detector and did jumping jacks, it probably would have finished and shut off even though motion was still going on, becuase there was no status change.

 

"control" is a trigger only when the device was controlled as written. So, your program written as "control off" only gets evaluated when the motion detector changes to off. When it swtiches back on again, the program keeps running, unless it is tripped again prior to completing and this starts it over. But, now you want it to start over which effectively keeps the light on until the motion stops happening for a while.

 

While writing the program using "control off" as you did works, it does have a flaw in that continuous motion will not keep the light on.

 

I would suggest writing this as two programs, one that switches the light on when the motion detecotr switches to "off", and one that turns the light off several seconds after the motion detector switches to "on".

Link to comment
While writing the program using "control off" as you did works, it does have a flaw in that continuous motion will not keep the light on.

I am not so sure that this is true. As you pointed out, each 'off' statement triggers an evaluation, at which point it will halt the program and start it at the beginning. This assumes that the motion sensor sends repeated off's, which I suspect it will (after the motion sensor time-out period). The only problem that I can see is if the motion sensor time-out is longer than the program wait period. Based on the original post, however, it sounds as if the motion sensor wait period is less than 5 seconds.

Link to comment
While writing the program using "control off" as you did works, it does have a flaw in that continuous motion will not keep the light on.

I am not so sure that this is true. As you pointed out, each 'off' statement triggers an evaluation, at which point it will halt the program and start it at the beginning. This assumes that the motion sensor sends repeated off's, which I suspect it will (after the motion sensor time-out period). The only problem that I can see is if the motion sensor time-out is longer than the program wait period. Based on the original post, however, it sounds as if the motion sensor wait period is less than 5 seconds.

 

I was making the assumption that continuous motion would keep the motion detector in a continuous state of "off". In that situation the program would run its timed course to conclusion and shut the light off. If the motion paused, the motion detector went to "on" state, then back to "off" state it would work fine. So maybe if you did a jumping jack, stood still for a few seconds, then did another jumping jack.

 

If the motion detector continued to send "off" commands despite already being "off", I think it would work

 

I was just reading my last post and think I may have miss-spoken on one item. I said that status changes reset a status program no matter what the change is. In fact, I believe that a status update also resets the program, even if there is no change. For example, an Insteon switch may be off already and you hit "off". That also will reset the program despite no change at all.

Link to comment

Here's where I ended up and it works perfect:

 

If

Control 'PIR Exterior / PIR Chimney' is switched Off

Or Control 'PIR Exterior / PIR Garage' is switched Off

Or Control 'PIR Exterior / PIR Front' is switched Off

And From Sunset

To Sunrise (next day)

 

Then

Set Scene 'Front Spots' On

Wait 3 minutes and 30 seconds

Set Scene 'Front Spots' Off

 

Else

- No Actions - (To add one, press 'Action')

 

 

Works perfect. If movement continued throughtout the timer period, it keeps resetting the timer. The PIRs go on and off activly with movement and as you move across the field covered by the 3 units.

 

I would love some help with one twist I'd like to add but don't know how. Sometimes, I will manually turn on the spots via a Insteon switch (one of two in the "Front Spots" scene) in the garage.

 

But if I turn them on manually and then walk in front of the PIR, it starts the timer and after the timer expires, it will turn the lights off. When I turn them on with the switch, I want them to stay on.

 

With the old system, as part of the PIR routine, I would first check to make sure the lights were off before I would trun them on from PIR activity.

 

How would I accomplish the same thing here?

 

Thanks.

 

J.D.

Link to comment

You will probably need to have two programs.

 

The second program contains the "then" section of your current program.

 

The first program has your current statements but also includes an "and status off" of one of the lights in the scene. The then section of this program will run the the then section of the second program.

 

The reason for this is becuase adding the "status off" statement in the if section will cause the program to retrigger when the then secton turns it on and kill your program again.

 

All of your headaches here are based on the fact that you have the delay mixed into the same program with all of these conditions. That delay allows for the program to be terminated since the then section changes things in the "if" section.

 

By separating the "then" items into a whole different program you avoid this problem and you could actually go back to using "status" as you wrote thins the first time.

Link to comment

There are many variations on the motion sensor theme. I learned much from the wiki, which addresses your concern. I think there are other wiki examples, also.

 

http://www.universal-devices.com/mwiki/index.php?title=ISY-99i/ISY-26_INSTEON:Using_X-10_Motion_Sensors

 

Another issue that you may run into is what happens when sunrise passes during your wait period. You program will stop and the light will never shut off. I agree with apostolakisl, there are benefits with separating your programs.

 

One of the problems with a simple solution to your twist is that is can often have circular logic. You could check that the light is not on as part of your condition, but the program would turn it on when motion is sensed, forcing evaluation of your condition (now false), stopping your program.

 

I cannot improve upon the recommendations in the wiki, so I suggest checking out the part about "motion disable".

Link to comment

Look at the Wiki as oberck says.

 

A good motion program will

 

1) turn the light on for a period of time if the light is already off

2) do nothing if the light is already on

3) do nothing during the daytime

4) allow you to adandon the timer by either hitting the on or off button on the switch (and having the light follow that command as well).

5) not get caught in an endless loop

 

By using multiple programs, separating your "then" from "if" sections, and using flag programs all of this can be done.

Link to comment

Guys:

 

Thanks again. I'm going to take your advice and study the wiki and go that route.

 

Any idea while the lights are going on during the day, given my "and" statement in the code above? It's seems pretty simple, not sure why they continue to function after sunrise.

 

Thanks.

 

J.D.

Link to comment

Is that correct?

 

If

Control 'PIR Exterior / PIR Chimney' is switched Off

Or Control 'PIR Exterior / PIR Garage' is switched Off

Or Control 'PIR Exterior / PIR Front' is switched Off

And-(

| From Sunset

| To Sunrise (next day)

-)

 

Then

Set Scene 'Front Spots' On

Wait 3 minutes and 30 seconds

Set Scene 'Front Spots' Off

 

Else

- No Actions - (To add one, press 'Action')

Link to comment

jdbaker

 

You want any of the first three If conditions Anded with the From Sunset to Sunrise

 

If

(

Control 'PIR Exterior / PIR Chimney' is switched Off

Or Control 'PIR Exterior / PIR Garage' is switched Off

Or Control 'PIR Exterior / PIR Front' is switched Off

)

And From Sunset

To Sunrise (next day)

 

Then

 

Without explicit parens the result looks like the following with parens ...

 

If

Control 'PIR Exterior / PIR Chimney' is switched Off

Or Control 'PIR Exterior / PIR Garage' is switched Off

Or

(

Control 'PIR Exterior / PIR Front' is switched Off

And From Sunset

To Sunrise (next day)

)

 

Then

 

 

Lee

Link to comment
Is that correct?

This is standard "Boolean Logic". There is a discussion about this in the wiki:

 

http://www.universal-devices.com/mwiki/index.php?title=ISY-99i/ISY-26_INSTEON:Scope,_Precedence_and_Execution_Order

 

Knowing the priority between "and" and "or" and using parenthesis is an important part of programming beyond the basic level. I found it to be good reading and hope you find it as useful as did I.

Link to comment

Archived

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


×
×
  • Create New...