Please login or register.

Login with username, password and session length
Advanced search  

News:

The Buster PiX10Hub is here! Created by the Community, for the Community.:)% #:)

Author Topic: Help with motion detection Light on/dimm then off scene  (Read 13217 times)

josephazzi

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Help with motion detection Light on/dimm then off scene
« on: September 22, 2007, 11:10:08 AM »

Hi guys pls i need ur help on how to make a macro that allow me when i enter the living room the lights goes on, and if no movemeent the light will dime to 50% after 3 minutes and after another 4 minutes with no movement the light goes off, but if any movement happens while it s dimmed the light should go to 100% again.

i have the motion sensor, and i need detailed  steps to achieve the above, i m new to smart macros and AH.
thank you in advance.
Logged

Puck

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 171
  • Posts: 1799
Re: Help with motion detection Light on/dimm then off scene
« Reply #1 on: September 22, 2007, 12:33:14 PM »

1) when i enter the living room the lights goes on

2) if no movement the light will dim to 50% after 3 minutes

3) and after another 4 minutes with no movement the light goes off

4) but if any movement happens while it s dimmed the light should go to 100% again.

Hello josephazzi, and welcome to the forum.

To do this, you will need to use a few macros and some status flags and the following:

1) set the motion sensors off timer for 3 minutes
2) Create a dummy appliance switch in AHP with the same address as the motion sensor

Module address assumptions (yours will most likely be different) for the purpose of the example:

Livingroom Motion Sensor: B1
Livingroom Light: C1

Macro1: MotionON1

Trigger:
B1 ON

Conditions:
Flag 1,2 Clear


Action:
C1 ON
Flag 1 Set


Macro2: MotionON2

Trigger:
B1 ON

Conditions:
Flag 1,2 Set

Action:
Brighten C1 by 50%
Flag 2 Clear


Macro3: MotionOFF1

Trigger:
B1 OFF

Conditions:
Flag 1 Set
Flag 2 Clear

Action:
Dim C1 by 50%
Flag 2 Set
Delay 4 minutes
B1 OFF


Macro4: MotionOFF2

Trigger:
B1 OFF

Conditions:
Flag 1, 2 Set

Action:
C1 OFF
Flag 1, 2 Clear
Logged

HA Dave

  • Hero Member
  • *****
  • Helpful Post Rating: 174
  • Posts: 7043
Re: Help with motion detection Light on/dimm then off scene
« Reply #2 on: September 22, 2007, 01:11:56 PM »

What a great reply Puck! That gets a HELPFUL from me!
Logged
Home Automation is an always changing technology

josephazzi

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Re: Help with motion detection Light on/dimm then off scene
« Reply #3 on: September 23, 2007, 12:32:36 PM »

Hi Puck thank you for your reply it s really helping but there s a problem i thing with the flags setting, because when the light is in dimmed mode and motion triggers it goes on (100%) then immediately back to 50% this part is notworking, the rest is flawless, can you please review the flags maybe try it and see the logic of it coz i belive the flags setting need adjustment.

again thanks and waiting for your reply.
Logged

Puck

  • Advanced Member
  • Hero Member
  • ******
  • Helpful Post Rating: 171
  • Posts: 1799
Re: Help with motion detection Light on/dimm then off scene
« Reply #4 on: September 23, 2007, 03:52:01 PM »

...when the light is in dimmed mode and motion triggers it goes on (100%) then immediately back to 50% this part is notworking,

There is no dimming command in any of the B1 Motion ON macros, so the only way it could be dimming is because of the delay in macro 3. Once this starts there is no way to stop it; and therefore, you can get a dimming right after the re-brightening.

There are 2 things to try to prevent this:

1) Lets move the 4 minute delay out of macro3 and place it in a dummy macro with another flag to prevent multiple entries. So make a Dummy Module (D1 for the new example below) with an appliance module.

2) Make your motion sensor's off timer larger than the 4 minutes delay of the macro. This will make sure the delay macro can be fully controlled and it's purpose cancelled by the motion sensor ON signal and allow it to time itself out before the motion sensor's OFF signal is received to cause multiple executions.


Macro1: MotionON1

Trigger:
B1 ON

Conditions:
Flag 1,2 Clear


Action:
C1 ON
Flag 1 Set


Macro2: MotionON2

Trigger:
B1 ON

Conditions:
Flag 1,2 Set

Action:
Brighten C1 by 50%
Flag 2, 3 Clear


Macro3: MotionOFF

Trigger:
B1 OFF

Conditions:
Flag 1 Set
Flag 2, 3 Clear

Action:
Flag 2 Set
Dim C1 by 50%
Delay 2 second
D1 ON


Macro4: DelaySTART

Trigger:
D1 ON

Conditions:
Flag 3 Clear

Action:
Flag 3 Set
Delay 4 minutes
D1 OFF


Macro5: DelayEND

Trigger:
D1 OFF

Conditions:
Flag 3 Set

Action:
C1 OFF
Flag 1, 2, 3, Clear

Logged

Newfie

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Re: Help with motion detection Light on/dimm then off scene
« Reply #5 on: December 17, 2011, 08:23:31 AM »

I have tried both your suggestions Puck and I still have issues, and thanks by the way for leading me in the right direction as I didn't have any idea how to start  #:).

If nobody enters the area after the first initial motion detection, the macro runs great, but if someone sets the motion again once or several times the light will flick on and off. I have tried to revamped the design but now when motion is detected after the initial detection the light sometimes doesn't shut off, it doesn't flicker like it did, but now stays on SOMETIMES! Most times it works!

I also noticed in my log that the sensors are sending signals to the next unit (i.e. My motion sensor P5 sends P6 on/off) I know this is a feature of the sensor but is there a way to shut this off, I'm thinking there is too much happening at the one time as I have 3 of these macros operating 3 sensors and 3 lights. I noticed that even though we set flags the macros that are delayed still finish running. Is there a way to cancel or (break) the code if the flags are not set, thus eliminating the code from continuing?

Could it be possible that some steps are being ignored due to the amount of requests being sent?
OR Could it be possible that if motion is detected so many times and we are entering the subroutines so often and delaying them so often that the flags are getting cross switched. (Perhaps being set when they shouldn't)

Sorry for all the questions but I'm new to the macro scene and drawing straws here as this is really bugging me. I am a self taught programmer though and understand programming quite well. Would be so nice to be able to manually edit macros via C++ or something ;)

Here is how I currently have revamped my macros.

Code: [Select]
(Module) | EE Motion Sensor | DUMMY APPLIANCE MODULE | WALL SWITCH (OLDER LAMP STYLE)
(Address) | P5 | D5 | A5
(Time Delay) | 4 Flashes / 8 Minutes | N/A | N/A

[MACRO #1]
(Name) Kitchen - Motion In Dark
(Trigger) P5(ON)
(Conditions) Flag Status Off (1) & It's Nighttime
(Action)
Set Selected Flags (1) // Let AH know we are running the macro, set (Flag1)
Set Module A5(ON) // Turn on the Kitchen light
Delay(00:00:30) // Wait 30 seconds
Module P5(OFF) // Send EE Motion Sensor Off command manually

[MACRO #2]
(Name) Kitchen - Motion In Light
(Trigger) P5(ON)
(Conditions) Flag Status On (1|2)
(Action)
Clear Selected Flags (2|3|4)                // Clear sensor off Flag(2), dimmer Flag(3), & final shutdown Flag(4)
Set Module A5(Brighten 50%)        // Brighten Kitchen light to full in case it was dimmed
Delay(00:00:30) // Wait 30 seconds
Module P5(OFF) // Send EE Motion Sensor Off command manually

[MACRO #3]
(Name) Kitchen - Sensor Off Cmd
(Trigger) P5(OFF)
(Conditions) Flag Status On (1) & Flag Status Off (2)
(Action)
Set Selected Flags (2|3)        // Let program know we have received an off command Flag(2), and ready to dim lights Flag(3)
Delay(00:00:30) // Wait 30 seconds grace period in case motion detected
Module D5(ON) // Send Fake Module D5 On command to dim lights before final shutdown

[MACRO #4]
(Name) Kitchen - Dim Light
(Trigger) D5(ON)
(Conditions) Flag Status On (1|2|3)
(Action)
Clear Selected Flags (3) // Disable repeating the dimming process, clear dimmer Flag(3)
Set Selected Flags (4) // Prepare for final shutdown, set final shutdown Flag(4)
Set Module A5(Dim 50%) // Dim Kitchen light in preparation for shutdown
Delay(00:00:10) // Wait 10 seconds
Module D5(OFF) // Send Fake Module D5 Off to execute final shut down

[MACRO #5]
(Name) Kitchen - Final Off
(Trigger) D5(OFF)
(Conditions) Flag Status On (1|4)
(Action)
Set Module A5(OFF) // Turn off the Kitchen light
Clear Selected Flags (2|3|4) // Clear sensor off Flag(2), dimmer Flag(3), & final shutdown Flag(4)
Delay(00:00:05) // Wait 5 seconds to avoid sensor being triggered by off command
Clear Selected Flags (1) // Let AH know we are finish running the macro, clear (Flag1)

Any help on this topic about how to get this working or tips on things I'm doing wrong would be greatly appreciated for anyone!

P.S. I am using Active Home Pro, Smart Macros, and CM15A

Regards
Newfie
« Last Edit: December 17, 2011, 08:31:07 AM by Newfie »
Logged

Newfie

  • Newbie
  • Helpful Post Rating: 0
  • Posts: 2
Re: Help with motion detection Light on/dimm then off scene
« Reply #6 on: December 17, 2011, 04:18:28 PM »

hmmmm, think I may have fixed it. Had to reset all 4 flags at each stage. Seems to have solved the problem, fingers crossed. Here is the code.
Tried commenting everywhere to let you see what's happening, and also tried keeping code as close to smart macro code as I could.

Code: [Select]
// (Module) | EE Motion Sensor | DUMMY APPLIANCE MODULE | WALL SWITCH (OLDER LAMP STYLE)
// (Address) | P5 | D5 | A5
// (Time Delay) | 4 Flashes / 8 Minutes | N/A | N/A

<macro name="Kitchen - Motion In Dark" code="P5" trigger="1">
<conditions>
Flag Status Off (1|2|3|4) & Nighttime (1)
</conditions>
<actions>
Set Selected Flags (1) // Let AH know we are running the macro, set (Flag1)
Clear Selected Flags (2|3|4) // Clear sensor off Flag(2), dimmer Flag(3), & final shutdown Flag(4)
Set Module A5(ON) // Turn on the Kitchen light
Delay(00:00:30) // Wait 30 seconds
Module D5(OFF) // Send Fake Module D5 Sensor Off command
</actions>
</macro>

<macro name="Kitchen - Motion In Light" code="P5" trigger="1">
<conditions>
Flag Status On (1|2)
</conditions>
<actions>
Set Selected Flags (1) // Let AH know we are still running the macro, set (Flag1)
Clear Selected Flags (2|3|4) // Clear sensor off Flag(2), dimmer Flag(3), & final shutdown Flag(4)
Set Module A5(Brighten 50 Percent) // Brighten Kitchen light to full in case it was dimmed
Delay(00:00:30) // Wait 30 seconds
Module D5(OFF) // Send Fake Module D5 Sensor Off command
</actions>
</macro>

<macro name="Kitchen - Manual Off Cmd" code="D5" trigger="0">
<conditions>
Flag Status On (1) & Flag Status Off (2|3|4)
</conditions>
<actions>
Set Selected Flags (1|2|3) // Set Flags, running macro (Flag1), received off command Flag(2), and ready to dim lights Flag(3)
Clear Selected Flags (4) // Clear final shutdown Flag(4)
Delay(00:00:30) // Wait 30 seconds grace period in case motion detected
Module D5(ON) // Send Fake Module D5 On command to dim lights before final shutdown
</actions>
</macro>

<macro name="Kitchen - Light Off" code="D5" trigger="0">
<conditions>
Flag Status On (1|2|4) & Flag Status Off (3)
</conditions>
<actions>
Set Module A5(OFF) // Turn off the Kitchen light
Clear Selected Flags (2|3|4) // Clear sensor off Flag(2), dimmer Flag(3), & final shutdown Flag(4)
Delay(00:00:05) // Wait 5 seconds to avoid sensor being triggered by off command
Clear Selected Flags (1) // Let AH know we are finish running the macro, clear (Flag1)
</actions>
</macro>

<macro name="Kitchen - Dim Light" code="D5" trigger="1">
<conditions>
Flag Status On (1|2|3) & Flag Status Off (4)
</conditions>
<actions>
Clear Selected Flags (3) // Disable repeating the dimming process, clear dimmer Flag(3)
Set Selected Flags (1|2|4) // Set Flags, running macro (Flag1), received off command Flag(2), and final shutdown Flag(4)
Set Module A5(Dim 50 Percent) // Dim Kitchen light in preparation for shutdown
Delay(00:00:10) // Wait 10 seconds
Module D5(OFF) // Send Fake Module D5 Off to execute final shut down
</actions>
</macro>

EDIT!!! Thought I had it but still having issues. The lights stay on a lot when motion is detected after light is on. Any help would be great ;)
« Last Edit: December 17, 2011, 05:57:12 PM by Newfie »
Logged
 

X10.com | About X10 | X10 Security Systems | Cameras| Package Deals
© Copyright 2014-2016 X10.com All rights reserved.