Please login or register.

Login with username, password and session length
Advanced search  

News:

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

Author Topic: How best to use a macro to trigger another?  (Read 849 times)

LAF

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 73
How best to use a macro to trigger another?
« on: August 22, 2017, 01:21:13 PM »

I have a macro that, when triggered, evaluates two conditions and then turns a dummy (no actual hardware) module on in order to then trigger a second macro which also evaluates two conditions and then turns some lamps on.  Trouble is, the second macro works OK (turns the lamps on) when triggered by the Run Macro icon but fails to execute properly when triggered by the first macro (the macro appears to trigger but the lamps do not turn on).  Both the macro icons are flashing at the same time through part of the cycle so it appears they may be interfering with each other(??). I have tried to program it that way as there seems to be no method of adding a delay or other instructions between two conditions(?).

What I'm trying to do here is test to see if a flag is set, delay a bit and test again if the flag is still set.  Using two macros, each of which test the flag is the only way I can think of doing it.

Any suggestions as to how to do this would be appreciated...
Logged

LAF

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 73
Re: How best to use a macro to trigger another?
« Reply #1 on: August 22, 2017, 03:11:09 PM »

Just an update - the apparent offending macros problem was caused by delays that had not completed before the macros were tested again (I should have done a Purge delayed Macro Events beforehand).  ::)

I'd still be interested in learning though if there's a better way of executing conditionals with delay(s) in between.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 266
  • Posts: 9540
  • I don't work for X10, I use it successfuly!
    • Tuicemen Software
Re: How best to use a macro to trigger another?
« Reply #2 on: August 23, 2017, 08:19:25 AM »

Many users (myself included) tend to over think a macro making them more complicated then needed.
Simpler ones always perform better
Macros can only be triggered from an X10 signal even a security one, though you can use timers.
Posting your actual macros may get a fresh set of eyes on it.
Include a description of what your trying to accomplish in great detail.
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum

LAF

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 73
Re: How best to use a macro to trigger another?
« Reply #3 on: August 23, 2017, 01:19:10 PM »

I'm trying to set up an alarm system using the MS16A motion sensor.  I use a flag to indicate if the alarm is "armed" and, if I set it to armed when I leave the house, I wish to have a bit of time to press the "disarm" button, when I get back to the house, before the alarm sounds.  So, all I want the macro to do is, when the macro is triggered by the sensor, first check to see if the alarm is armed, if it is not do nothing, if it is on, wait a minute for me to disarm the alarm.  After that one minute timer expires, check again to see if the alarm is still armed.  If it is, sound the alarm, if it is not, do nothing.  IOWs:

Sensor triggers macro
Is flag on?
No - exit macro
Yes - delay one minute
Is flag on?
No - exit macro
Yes - trigger the alarm

It would be easy if it were possible to put a delay between two conditions but it's not (I think) so two macros seem to be needed (1st condition followed by delay in one 1st macro and 2nd condition in the 2nd macro).

Also, I had installed AHP in the 386 programs directory but re-installed it to the C: directory when I installed Lifeguard as I read in someone's comments that that is required for proper operation.  One thing I noticed though was that a small circular icon is now missing from the module icons (just to the right of the comment and display log icons).  IIRC that now missing icon was to disable a module (or macro?), or something similar, without having to delete it (which would be a desirable feature).  Is there any way of getting that icon back??

And, how do you trigger a macro by a timer (if I understand what you wrote correctly)?

Thank you again.  All the assistance is appreciated!  :)
« Last Edit: August 23, 2017, 08:36:43 PM by LAF »
Logged

Brian H

  • Community Organizer
  • Hero Member
  • ***
  • Helpful Post Rating: 289
  • Posts: 12729
Re: How best to use a macro to trigger another?
« Reply #4 on: August 27, 2017, 08:16:49 AM »

One thing to remember.
The MA16A also has a Dusk Dawn Sensor in it. Set to the Motion Sensors X10 address +1 Unit Code.
Like if you have motion on D1. By default. When it gets dark it will send a D2 On and a D2 Off when it gets light.
Instructions on the Wiki show a set of button pushes to disable dusk dawn sensing or make it only detect if it is dark.
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 266
  • Posts: 9540
  • I don't work for X10, I use it successfuly!
    • Tuicemen Software
Re: How best to use a macro to trigger another?
« Reply #5 on: August 27, 2017, 08:33:16 AM »

Since your trying to setup a macro with security conditions the CM15 must be connected to the PC and it running for it to work correctly.
In order to trigger a macro from a timer you can click on the clock icon bottom right of the macro button.
Since the macro has a trigger you can set a timer to fire the trigger.

Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum

LAF

  • Full Member
  • ***
  • Helpful Post Rating: 0
  • Posts: 73
Re: How best to use a macro to trigger another?
« Reply #6 on: August 27, 2017, 08:34:19 PM »

But the MA16A doesn't have to be used with the security software - it can be used a a standard type module and that is what I'm doing with it now (for my "security system" that doesn't require the PC to be running for it to function).

Brian, I found out about "+1" property of the MA16 quite by accident as I had assigned an appliance module to the +1 unit code (should have read the directions first I guess  :-[ ).

Anyhow I still wish there was a way of placing conditions at other than the beginning of a macro...

It looks like triggering a macro by a timer requires multiple timer instances if, for example, one wanted to trigger a macro every hour, 24 timers would be needed(?).  Or, maybe one could have a macro do it's thing and then delay one hour, followed by the macro triggering itself??
Logged

Tuicemen

  • Administrator
  • Hero Member
  • ****
  • Helpful Post Rating: 266
  • Posts: 9540
  • I don't work for X10, I use it successfuly!
    • Tuicemen Software
Re: How best to use a macro to trigger another?
« Reply #7 on: August 27, 2017, 09:26:16 PM »

I guess I got confused with the last statement of the macro.
I thought you were triggering a X10 security alarm but reading again I see you didn't state that.
you need to use an else or two.
this way if the macro is tripped and condition isn't met the else macro fires if its condition is met
Logged
Please Read Topic:
General Forum Etiquette
Before you post!

Find extra info @ My forum
 

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