macros and flags

Started by jatracy, May 09, 2006, 02:39:57 PM

Previous topic - Next topic

jatracy

Here is my setup:
1 motion sensor in garage (C13)
1 switch to control lights (C13)

For the most part the motion sensor is doing a fine job. I have had instances where the lights were left on though. My concern is that the switch I am using does not report it's status back to AHP so therefore I do not(yet, see below) have a confirmation that the lights did indeed shut off.

Here is what I want to do:
Use C14 to indicate the status of the lights (C14 is ON when the lights are OFF, C14 is OFF when the lights are ON) by setting a flag.
run a smart macro to look at the state of C13 and the flag (if the flag is set AND C13 is OFF) then turn C13 OFF (you see, just because AHP sent the command to turn C13 OFF, that does not mean that C13 actually turned the lights off).

The problem I have is that there is not a real good way to run the smart macro at a regular interval (like every 5 minutes or so).

I am fairly new to AHP and X10 and any suggestions would be greatly appreciated.

steven r

Check your instructions for your motion sensor. Many use to the next address also I believe for a dusk/dawn signal.
ie If your using C13 for your sensor, stay away form C14.

Also most motion sensors will send an off signal after a preset time.

Most switches do not report their status at all when switched locally.

BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

jatracy

That is precisely the functionality that I am exploiting. When the lights come on, then C14 says it is daytime (sends X10 message C14 OFF).

I can see that the motion sensor is sending the off command but there is no guarantee that the switch responded to the off command due to numerous reasons. I am trying to improve the reliability of the PLC interface. The RF interface seems to work very well.

The problem I have is: How do I get the smart macro to run in a continuous loop without setting up a timer to have it run 288 times a day (every 5 min)?

Sure, I could easily increase the interval, but what I am looking for here is a good theory of operation, not really an implementation (Quality vs. Quantity).

steven r

Ok.. Let's see if I understand what you're trying to do.
You have a motion sensor set on C13 to turn on light C13 and you also want to use the dusk/dawn feature of the motion sensor to detect if the light is on. Am I right? Hmm.. Interesting approach.
That said; what is your objective? Turn the light off after a period of time? Report that the light was turned off when you send it a signal from another controller somewhere else. Simply make sure the light wasn't left on too long?
While I like your idea, I'm not sure how easy or practical implementing it would be. Seems like on the motion sensor I use to have you had the option to set the motion sensor as to whether it responded all the time or just at night. That setting might affect the dusk/dawn feature you're trying to use.
Keep in mind that your motion sensor will be sending a "C13 OFF" signal after your preset time.
If you want to really want to make sure that a "C13 OFF" signal from the sensor or a switch truly turns off the light, build a marco C13 that turns the light off 3 times with a 30 second delay between each "OFF". Baring any constant line signal problems, you can be pretty sure the light is off. If you take this approach, you might want to put the light and the macro on different codes.

Both of my X10 flood lights seem to come on if a butterfly goes by in the distance. I built macro that sends an off signal 5 minutes after they come on. I also have an off time for each hour of the day.
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

roger1818

Quote from: jatracy on May 09, 2006, 02:39:57 PM
I have had instances where the lights were left on though.

There are three possible reasons why the light doesn't get turned off:
1) The CM15A doesn't hear the command from the Motion sensor.
2) The light switch doesn't hear the command from the CM15A.
3) Someone turned the light on manually and forgot to turn it off.

Have you checked which one it is?  If it is the first cause, then the CM15A may not hear the C14 ON command also and your technique won't work.  If it is the second one, your technique should work quite well.  If it is the third one, it might turn the light off while someone is still inside the garage.

Having said that, one way to have a macro run every 5 minutes would be to have a time delay in it and have it call itself:  The macro could look something like this:

M1 ON
Conditions:
C14 OFF and C13 OFF
Commands:
C13 OFF
Delay 5 minutes
M1 ON

else
Conditions:
C14 ON or C13 ON
Delay 5 minutes
M1 ON

This way all you have to do is run M1 once and it will keep looping every 5 minutes.  My suggestion would be to make the delay longer than 5 minutes, but you can do what you want.


steven r

Quote from: roger1818 on May 10, 2006, 01:06:39 PM
...
M1 ON
Conditions:
C14 OFF and C13 OFF
Commands:
C13 OFF
Delay 5 minutes
M1 ON

else
Conditions:
C14 ON or C13 ON
Delay 5 minutes
M1 ON
...

Is AHP properly allowing a macro to call a macro now or would you need a dummy M1 module for this to work? Seems to me once upon a time AHP required a virtual module for this to work. I'd love to be able to stop building dummy modules for every macro I need to call.
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

roger1818

Quote from: steven r on May 10, 2006, 01:18:38 PM
Is AHP properly allowing a macro to call a macro now or would you need a dummy M1 module for this to work?

To the best of my knowledge you still need to create a virtual appliance module at address M1.  I guess I forgot to mention that.

steven r

The one thing that makes endless looping macros so potentially useful is the same thing that makes them a possible nightmare.

Take the above example. Suppose the M1 macro were accidentally triggered a 2nd time or God forbid a 3rd time. I don't even want to try to follow all the possible logic flow if more than one of the same macro, with an else no less, were looping.

I've managed to stay away from them so far and hope I never need to have to use one.
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

jatracy

Quote from: roger1818 on May 10, 2006, 01:06:39 PM

There are three possible reasons why the light doesn't get turned off:
1) The CM15A doesn't hear the command from the Motion sensor.
2) The light switch doesn't hear the command from the CM15A.
3) Someone turned the light on manually and forgot to turn it off.

Have you checked which one it is?  If it is the first cause, then the CM15A may not hear the C14 ON command also and your technique won't work.  If it is the second one, your technique should work quite well.  If it is the third one, it might turn the light off while someone is still inside the garage.

#1 would concern the RF interface which seems to be working good.
#2 is exactly the scenario that I am looking to solve.
#3 would be handled by the "(if the flag is set AND C13 is OFF)" condition as long as the person in the garage is moving being that the motion sensor will not set C13 to OFF until no motion has been detected for a preset amount of tiime.

jatracy

Quote from: roger1818 on May 10, 2006, 01:48:36 PM
Quote from: steven r on May 10, 2006, 01:18:38 PM
Is AHP properly allowing a macro to call a macro now or would you need a dummy M1 module for this to work?

To the best of my knowledge you still need to create a virtual appliance module at address M1.  I guess I forgot to mention that.

That must have been what was keeping it from working when I tried that. I did not setup a dummy module.

roger1818

Quote from: jatracy on May 10, 2006, 02:25:49 PM
#3 would be handled by the "(if the flag is set AND C13 is OFF)" condition as long as the person in the garage is moving being that the motion sensor will not set C13 to OFF until no motion has been detected for a preset amount of time.

If the light is on and the motion sensor is set for night time only, it won't send the on command so the CM15A will think C13 is supposed to be OFF.

roger1818

Quote from: jatracy on May 10, 2006, 02:30:41 PM
Quote from: roger1818 on May 10, 2006, 01:48:36 PM
To the best of my knowledge you still need to create a virtual appliance module at address M1.  I guess I forgot to mention that.

That must have been what was keeping it from working when I tried that. I did not setup a dummy module.

Unfortunately the "Advanced Commands" on command for an arbitrary address assumes that the module is a lamp module, so instead of sending M-1 M-ON it sends M-1 M-Bright 100% which won't trigger the macro.  There is an option now to let you have all Absolute 100% commands to send the on command instead, but it will apply to ALL macros which could cause other macros to not work as expected.

jatracy

Quote from: roger1818 on May 10, 2006, 02:32:42 PM

If the light is on and the motion sensor is set for night time only, it won't send the on command so the CM15A will think C13 is supposed to be OFF.
You are correct in saying that the motion sensor will not send a command to turn C13 ON if the light (C13) is already on.

Whoops, I forgot to mention that the motion sensor is set to only report motion at night. In this mode, it will send a command to turn C14 ON (because it thinks it is now night time) when the lights go off and C14 OFF when the lights come on (or the garage door is open, but I would want the garage lights off in that case as well so that is just an added "feature" that I hadn't considered).

Is everyone thouroughly confused yet?

Basically, the motion detector is doing exactly what I want it to (even if it wasn't designed to solve this problem), but I don't think it would work if the motion detector was set to detect motion at all times because then it would have no need to send the "it is night" or "it is day" commands.

steven r

#13
Quote from: roger1818 on May 10, 2006, 02:43:48 PM
...Unfortunately the "Advanced Commands" on command for an arbitrary address assumes that the module is a lamp module, so instead of sending M-1 M-ON it sends M-1 M-Bright 100% which won't trigger the macro.  There is an option now to let you have all Absolute 100% commands to send the on command instead, but it will apply to ALL macros which could cause other macros to not work as expected.
Hmm... I hadn't thought of that but I haven't had any problems. Maybe I currently have my AHP set for to send the on command. Does it only make a difference if you don't have a dummy module?

It shouldn't matter if you use a dummy appliance module instead of a dummy light module should it?

Just tested it. I was able to call a macro from a macro with both settings using a dummy chime module.
BVC let's me tell my camera where to go!
:) Murphy is my beta testing pal. He helps me find problems whether I like it or not. :)

roger1818

Quote from: steven r on May 10, 2006, 08:06:35 PM
Hmm... I hadn't thought of that but I haven't had any problems. Maybe I currently have my AHP set for to send the on command. Does it only make a difference if you don't have a dummy module?

It shouldn't matter if you use a dummy appliance module instead of a dummy light module should it?

The setting will only affect you if you aren't using a dummy appliance module for the ON command.  The off command is by AHP for both lamp and appliance modules.

Quote
Just tested it. I was able to call a macro from a macro with both settings using a dummy chime module.

I have never tried it before, but that makes sense since it will probably send an On command.  The documentation isn't very clear on this, but what commands does a chime module respond to?

SMF spam blocked by CleanTalk