Jump to content
C4 Forums | Control4

PIR/Motion Sensor Timer


ihod

Recommended Posts

Some help required, please....I have a PIR sensor linked to C4 via a contact switch. When the PIR triggers the contact switch I want an External Light scene to run for 10 minutes (and if the PIR has been triggered during that 10 minutes, to extend for 10 minutes beyond the last trigger point).The External Light scene comes on 1 hour before sunset and off at 22:30, then on at 06:10am, hence the Conditional at the start of the program. So the intention is, if its dark and the lights are off, they come on for 10 minutes after the PIR last senses movement, then switches off. Its not working.....can someone point in in the right direction, please? I've attached the listing here:

 

C4 PIR Script.jpg

Link to comment
Share on other sites


To make your programming easier

Do conditional with sunset and sunrise +1 hour since this time is always changing

Do when PIR detect motions turn lights on or scene and reset timer you made for 10 minutes

When timer expires turn lights off

Link to comment
Share on other sites

First problem is you need to indent one more time everything that is below "'if timer "PIR Activated Lights" is running'

Also, you're better off using the timer agent to turn off the lighting scene when it expires

Link to comment
Share on other sites

Thanks, both.

The external lights scene comes on 1 hour before sunset and turns off at 22:30 (with a different scene coming on at 06:10). So I just need the PIR to trigger the lights during darkness (so between 22:30 and 06:10) for 10 minutes if someone walks by.

I think I've got it (see attached). I've set the timer parameters to activate or deactivate the scene. When the timer starts, the scene is activated. If the timer is on (i.e. the PIR is re-triggered during the 10 minute period), it resets and stays on for 10 minutes more. When the timer expires - lighting scene off.

I've tested this (by removing the time conditional) and it appears to work.

 

c4.jpg

Link to comment
Share on other sites

The current programming now will still only activate based on the very first condition, not the two secondary conditions.  You still need to indent the action(s) below the two secondary conditions one more time.

EG.

? If time is between 10:30 PM and 06:10 AM

(indent) ? IF Timer "PIR Activated Lights' is running

                (indent) -> Reset Timer 'PIR Activated Lights'

 (indent) ? If Timer 'PIR Activated Lights' is not running

                  (indent) -> Start Timer "PIR Activated Lights'              

Link to comment
Share on other sites

Also - you don't need to check if the timer is already running.

You don't need to choose reset for one option and start for the other.

just 'reset timer' - this starts the timer from zero:

 

? If time is between 10:30 PM and 06:10 AM

                (indent) -> Reset Timer 'PIR Activated Lights'

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.