X10 Community Forum

🖥️ActiveHome Pro => Plug-ins => Smart Macros => Topic started by: steven r on November 23, 2004, 11:17:33 AM

Title: More problems with conditionals macros
Post by: steven r on November 23, 2004, 11:17:33 AM
I've developed a love / hate relation for
the conditionals macros. (I refuse to call
them smart macros till I can get one to
work the way they're suppose to work.)

My latest test simply tests a time range
during the if condition with no conditions
in the else.

Based on my understanding, I expected it to
execute the if during the time and the else
all of the other time.

It executes the if all the time even
outside the range.

For what its worth, this is the code it
generates.

<macro name="TEST 1" code="P1" trigger="1"
id="4000024" moduleid="2000045"
ts="127456987861674368" download="1" >
<el cmd="4" area="3" room="1000004"
target="1000004" />
<el cmd="7" area="1"
target="2000010" level="100" />
<conditions>
<el condition="8"
operand="5" operation="0" timehour="9"
timemin="0" condition2="0" operand2="4"
timehour2="10" timemin2="55"  />
</conditions>
</macro>
<macro name="Test else 1" code="P1"
trigger="1" id="4000026" moduleid="2000047"
ts="127456964573287312" download="1" >
<el cmd="4" area="3" room="1000004"
target="1000004" />
<el cmd="7" area="1"
target="2000024" level="100" />
</macro>
Title: Re: More problems with conditionals macros
Post by: kevinw on November 23, 2004, 04:27:41 PM
Steven R,
This should work.  It should execute
the "test 1" macro during the condition
time and the "test else 1" macro outside
the condition.  One comment though, the
commands to execute are the same for both
the IF and the ELSE macro.  They should be
different to be able to tell the difference
between the two, right?
Title: Re: More problems with conditionals macros
Post by: steven r on November 23, 2004, 11:36:25 PM
The way it was explained to me is that the
the if the conditional is true it executes
otherwise it moves on to the next else.

I've been using the wizard to create my
conditionals. I've just discovered that if
I create an if with "it's between hours I
specify", it doesn't work. On the other
hand if I use "It's after the time I
specify" followed by "It's before the time
I specify", it works.
Title: Re: More problems with conditionals macros
Post by: rick j on November 25, 2004, 04:04:36 AM
I've found that when I used between I need 2
entries so I'll set a flag and I'll use that
flag as a condidtion in my elses to do what
I need...
Title: Re: More problems with conditionals macros
Post by: steven r on November 30, 2004, 10:40:22 PM
This problem still exists with version
3.170!

I've been using the wizard to create my
conditionals. I've just discovered that if
I create an if with "it's between hours I
specify", it doesn't work. On the other
hand if I use "It's after the time I
specify" followed by "It's before the time
I specify", it works.
Title: Re: More problems with conditionals macros
Post by: steven r on December 01, 2004, 01:29:04 AM
3 more problems...

Time range won't wrap over midnight. (May
have existed before 3.170.)
e.g. An after 12:01 am and before 12:10 am
works but an after 11:00 pm and before
12:10 am doesn't work.

Time range is off by 1 minute. (Existed
before 3.170.)
e.g. An after 12:00 am and before 12:20 am
is true until 12:21 am. i.e. It will
execute at 12:20 am!

AHP update flag isn't totally cleared after
downloading.  (Existed before 3.170.)
e.g. I edit a macro. The download macro
icon appears. I download marcos and timers.
The icon clears. I click on the room where
the macro is. Poof.. The AHP download icon
reappears telling me I need to download
macros again.
Title: Re: More problems with conditionals macros
Post by: X10 Pro on December 01, 2004, 01:39:08 PM
We're looking at the problem with between
times in the Condition Wizard. It could be
that we fixed the problem only in Advanced view.

We'll fix the download icon problem, too.
That should be pretty simple.

Because the CM15A interface works on a day
that goes from midnight to 11:59 PM, the
condition "After 11 PM AND Before 12:10 AM"
will never be true -- after 11PM is 11:00 to
11:59, and before 12:10 is from 12:00 to
12:10 AM. If you do this as an OR ("After
11PM OR Before 12:10 AM") it will work. It's
counterintuitive, I know, but that's how it
works.

The time ranges in conditions are always
inclusive. That is the interface checks to
see if the time is less than or equal 12:20
AM, not just less than. If you adjust your
range to account for that you'll be OK.
Title: Re: More problems with conditionals macros
Post by: steven r on December 01, 2004, 11:31:38 PM
Thanks!

As long as AHP can be programed to work
consistently in a repeatable and
predictable manor, I can live with it being
counterintuitive and off a minute. :)
Title: Re: More problems with conditionals macros
Post by: donald mcmow on December 01, 2004, 11:41:44 PM
You guys all have to remember that the
SECONDS are not looked at when any of the
time checks azre made. the program only
looks at hours and minutes. Since ALL of
the programing within AHP is setup to
acount for Hours and Minutes only your
macro checks will disreguard the seconds. I
can't think off hand where you would need
to worry about anything less than a minute
in a home situation - normally there is
nothing that critical running that needs to
be watched that closely.
Title: Re: More problems with conditionals macros
Post by: steve on December 02, 2004, 10:26:44 AM
"SECONDS are not looked at when any of the
time checks are made". Is this true for the
delay feature?  Wait 5 seconds  becomes 1
minute?
Title: Re: More problems with conditionals macros
Post by: donald mcmow on December 02, 2004, 10:32:51 AM
No - delays are counted to the second -
only where you can not enter the seconds is
this a factor. Delay's allow for the entry
of seconds - the other time checks do not
allow for the entry of seconds and as such
your macro/event will run up to 59 seconds
later than when you might expect it to. I
don't think that would affect anything
unless you needed something to execute with
a resolution of seconds rather than minutes.
Title: Re: More problems with conditionals macros
Post by: steven r on December 02, 2004, 11:39:30 AM
"You guys all have to remember that the
SECONDS are not looked at when any of the
time checks azre made. the program only
looks at hours and minutes...."
Title: Re: More problems with conditionals macros
Post by: steven r on December 02, 2004, 12:11:01 PM
Disregard previous incomplete message. I
submitted by mistake.

"...Since ALL of the programing within AHP
is setup to account for Hours and Minutes
only your macro checks will disregard the
seconds...."

I still logically would had expected a
condition "before 10:00 pm" to be false at
10:00 pm.

"...I can't think off hand where you would
need to worry about anything less than a
minute in a home situation."

True but for testing purposes it's nice to
know where the condition ends. I also have
a light set to go off randomly between
midnight and 1:00 am. If I'm doing a
conditional "reset" of lights just before
midnight, it is important not to have them
overlap.

e.g. I have a shutdown macro that turns
most everything off when triggered. It
calls another macro to see if the front
light should be on. If it is before 12:00
am the light needs to be turned back on.
Knowing that AHP tests for "less than or
equal" and not "less than" allows me to set
my less than time for 11:58 pm to insure
the light in not turned back on for the
night.

Granted this overlap won't happen often but
Murphy has a way of finding and exploiting
these situations against me. :)