X10 Community Forum

📱🖥️PiX10Hub => 💬General Discussion => 📝User created HG Scripts (programs/macros/widgets) => Topic started by: edjal on May 19, 2019, 02:42:44 PM

Title: Help with macro script
Post by: edjal on May 19, 2019, 02:42:44 PM
  I am switching from AHP to Home Genie and I am trying to duplicate a couple of AHP macros. I am a complete newbie to HG and I have no experience with programmers languages so I am trying to setup macros using HG macro program wizard scripts.
  I have setup a schedule in HG to turn on Ext pole lamp x10A4@ 8:30am and off at 11pm. Note the lamp has light sensor so is not actually on but 125v socket is on so that I have power outdoors during these hours scheduled

The macros I would like to develop would go like this: (Macro Driveway Alert):  from 8:30 am till 10:55pm if motion sensor X10 B2 senses motion activate x10 B1 chime.

Next: (Ext Pole Light Macro): from the hours between 11pm and 8:25am if motion sensor X10 B2 senses motion turn on Ext pole light X10A4 delay 5 minutes then X10 A4 Off

please note the chime B1 would not activate during the active Ext Pole Light Macro.

 Is there someone on this site that would be willing to help me develop these HG Macros? I would greatly appreciate it
Title: Re: Help with macro script
Post by: bkenobi on May 20, 2019, 01:55:51 AM
I'd recommend looking at the smart lights app.
Title: Re: Help with macro script
Post by: Tuicemen on May 20, 2019, 07:50:21 AM
I'd recommend looking at the smart lights app.
I was going to recommend looking at your advanced smart lights addon bkenobi over the smart lights as it is a little easier for a newbie to figure out.

The chime macro can be created with a wizard script using the capture  in the trigger click capture and press B2 on a palm pad to capture the raw RF (20 70 8F 10 EF ) and then set before 8:30 and after 22:55 times.



Title: Re: Help with macro script
Post by: bkenobi on May 20, 2019, 12:12:04 PM
Either would work.  Since OP is just doing simple "turn light on with motion, off after delay", the basic version included with HG would work.  Using mine would work too in the same way and would allow for more flexibility should more be wanted down the road.
Title: Re: Help with macro script
Post by: edjal on May 21, 2019, 12:16:16 AM
 Thank you both for your input. My mini SDs will be here Friday hopefully then I can figure  out HG. Right now I cant even seem to set my widgets on the dashboard to link up I have a driveway sensor widget that I want to control driveway alert but driveway alert does not respond no matter how I configure. Im assuming I have ti Have RPi and mini SDs setup before program will operate on the Dashboard
Title: Re: Help with macro script
Post by: bkenobi on May 21, 2019, 11:55:50 AM
HG will work 100% on any system that can run Mono (with a compatible version).  I ran HG on a laptop for testing before I had my RPi and it worked very well.  If you can't get things working on the Windows machine (I'm assuming that's what it is), you will not likely have better luck on the RPi since it's setup is identical.  Waiting for the final hardware is ok, but you will have to fix the setup at some point.
Title: Re: Help with macro script
Post by: edjal on May 21, 2019, 12:36:32 PM
 Thank you so much for your Reply I have been tinkering with HG for about 2 weeks now on my win 10 pc  I feel like I'm shoveling sand against the tide. If you would give me an example on how to link 2 modules I created in a x10 group 1. Driveway Sensor X10 B2 2. Driveway alert X10 B1. How do I program Driveway Alert to respond to Driveway Sensor on the dashboard. Your help would be so much appreciated
Title: Re: Help with macro script
Post by: bkenobi on May 21, 2019, 05:30:50 PM
I generally use C# code for anything more than a list of module actuations. It sounds like you want something simple like "turn A1 on if A2 turns on" and then "turn A1 off when A2 turns off".  You could use a wizard script.  You could also just use the advanced smart lights code to do this though it's more robust than you really need.
Title: Re: Help with macro script
Post by: edjal on May 21, 2019, 05:47:41 PM
 The problem I'm having is I apparently don't know how to develop the script properly as they wont work for me for some reason That's why Im hoping for an example to follow.   I want Module "Driveway Motion Sensor X10 B2" to Turn On "Driveway Alert X10 B1 when motion sensed from b2 This would be so helpful to me To have an example to follow.
Title: Re: Help with macro script
Post by: Tuicemen on May 21, 2019, 06:35:45 PM
@edjalyou stated your moving from AHP to HG, is AHP installed? Since these two programs use different drivers conflicts will develop which may prevent things from working correctly.
Also which X10 interface are you using?
Title: Re: Help with macro script
Post by: edjal on May 21, 2019, 06:54:34 PM
AHP is installed and running on a different computer "My Laptop".   The interface is a CM15a. I have not yet downloaded the RPi image.  I have installed HG on "My Desktop"
Title: Re: Help with macro script
Post by: Brian H on May 22, 2019, 06:03:14 AM
Is the CM15A the same one you where using for AHP?

When I was using the PiX10Hub one of the tips with a CM15A. Was clear its memory and set all the Transceived House Codes to None. I found HG set the used House Codes it was using.
Title: Re: Help with macro script
Post by: edjal on May 22, 2019, 10:19:05 AM
 Thank you for your reply.  The Cm15 running AHP is the only one I have and it is presently using AHP software setup on my laptop. I am trying to figure out how to configure HG software on my desktop. My desktop does not have AHP on it. At this point the RPi is not in service yet. Once I figure out how to configure HG software I will clear memory on CM15 and link it to the RPi. An example of mine I added a module X10 A2 named it Furnace went into scheduler and setup a schedule on at given dates 8am off at 9am. when I watch the furnace icon on the Dashboard at time an event is supposed to happen the icon does not indicate it has responded to either the on or the off command from the schedule.  Another module I setup I named it Pole Light same problem does not respond to schedule, But if I click the on indicator of the icon to on it remains lit for a few seconds and then switches to off. When this happens a message in upper R corner of dashboard flashes colored lights then turns off pole light. I have no idea what is controlling pole light or how to change it. So I guess I really need some basic help with HG software.  Any help would be appreciated.  Thank you
Title: Re: Help with macro script
Post by: edjal on May 22, 2019, 10:33:55 AM
 I have to to make a correction to my last post The pole light I mentioned the module is X10 A4 and when I turn it on manually after a few seconds in the upper r corner of the dashboard it flashes "smart lightsA4 Pole Light switched off"  then flashes "Dashboard pole light level 0.00"   I have no Idea what is controlling it.   Once the pole light is off it remains that way and does not switch itself to on.
Title: Re: Help with macro script
Post by: Tuicemen on May 22, 2019, 10:41:25 AM
Since you have a schedule for the pole light setup in HG it is likely that is what is switching it.
Using HG in virtual mode (with no Cm15 interface connected) may also be what is causing weird results.
Title: Re: Help with macro script
Post by: edjal on May 22, 2019, 11:11:43 AM
  Thank You again for your concern in trying to help me with HG. I found what is causing pole light turning off via smart lights if I disable smart light in Pole light module settings it no longer turns off the module after a few seconds. When I enabled smart lights in the Furnace module settings and it reacted the same way as the pole light module did before. So you suspect I cannot get these modules to respond to a HG schedule virtually without the CM15 (memory cleared) connected to my Desktop via usb? I was hoping to keep AHP in service until I had HG setup properly but If I have to discontinue I will. I guess I assumed I could run a program virtually as some of the pre configured modules seem to respond correctly.
Title: Re: Help with macro script
Post by: Tuicemen on May 22, 2019, 11:23:00 AM
You can run HG in virtual mode however this will not ensure everything works as expected once the CM15 is connected.
Title: Re: Help with macro script
Post by: edjal on May 22, 2019, 11:33:06 AM
 OK thanks for the info I am going to keep AHP in service until I know the basics of HG configurations. I know that eventually with experimentation and help from you and others on the forum I will get there.
Title: Re: Help with macro script
Post by: edjal on May 22, 2019, 06:54:37 PM
 -:)Progress I have the scheduled timers working virtually. In scheduler pole lights A4 cron events wizard I selected Modules Tab then put a check mark @ lights then selected Pole Lights A4   then the script tab and selected add code snippet then Turn ON/Off Range and now pole light responds to the calendar timer.   If I configure the Pole Light Widget and select enable smart lights something else controls it to turn off  when in on position every few seconds. I have no Idea why but as long as I don't enable smart lights it obeys the scheduler. I was about to give up on this software what a relief to finally make some progress. I am very thankful to those trying to assist me with HG.   Next I have to figure out configuring the 2 macros I mentioned earlier. Thank You again for the assistance and ideas.      edjal
Title: Re: Help with macro script
Post by: bkenobi on May 23, 2019, 11:24:33 AM
When you say "virtual mode" do you mean a virtual module?  Otherwise, I have no idea what you are referring to.  HG is running or it isn't.  You can run it without a controller, but I don't think you will be able to add X10 modules without a controller.  If you have the controller enabled in software and it's not connected, I believe HG will give errors to the log file but perhaps will still appear to be running correctly to the user.
Title: Re: Help with macro script
Post by: edjal on May 23, 2019, 12:27:25 PM
Thank You for your interest  in helping me with HG.  I mean not yet controlled by RPi just by virtual x10 modules within  HG software that I created. Ex. I created and named X10 A4 Module "Pole Light X10A4" then set it up in scheduler and now the Pole Light widget on the dashboard responds to the on/off commands sent by the schedule