HomeGenie Forum

Automation Program Plugins and Wizard Scripting => APP Contributions => Topic started by: jshan on December 10, 2014, 06:19:51 AM

Title: X10 using Firecracker CM17A
Post by: jshan on December 10, 2014, 06:19:51 AM
I had some X10 modules and a CM17A (RS232 X10 RF transmitter) lying around.  Got it working with HomeGenie on a RaspberryPi.  The solution is probably applicable on Windows with some changes.  Here's what I did (assuming you're using the pi account):
- downloaded a python script called firecracker.py from http://www.collindelker.com/wp/2010/12/python-interface-to-x10-firecracker-cm17a/ (http://www.collindelker.com/wp/2010/12/python-interface-to-x10-firecracker-cm17a/)
- got a Trendnet TU-S9 USB to serial cable
- used putty to get to the rPi.  used "ls /dev/tty*" to see what ports are there
- plugged in the USB to serial cable
- ls /dev/tty*" to see what's new - that's your serial port: for example: /dev/ttyUSB1
- installed pySerial on raspberryPi using putty: sudo apt-get install python-serial
- copied firecracker.py to /home/pi (using WinSCP)
- Test: command from putty: "python firecracker.py a 1 ON /dev/ttyUSB1" where the "a" is the house, "1" is the unit.
- wrote a C# program to turn X10 virtual modules on/off (see attached).  In the program, you can set the house (defaults to "a") and the port (defaults to /dev/ttyUSB1).  The program is set up for modules 1-4.  You can expand this by editing the AddVirtualModules in the trigger code - change the 4 to up to 16.

I hope this is useful to someone.
- JohnS
Title: Re: X10 using Firecracker CM17A
Post by: gwhip70 on February 17, 2015, 11:44:59 AM
Awesome, worked perfectly.
Title: Re: X10 using Firecracker CM17A
Post by: ebasta on March 06, 2015, 09:17:17 AM
Is there anyway to modify the HGX so that the Dim % command will work - I tested the python script and these work:

python firecracker.py a 4 DIM /dev/ttyS0 (Dims module a4 by 5%)
python firecracker.py a 4 BRT /dev/ttyS0 (Brightens module a4 by 5%)

I just don't know enough of how HomeGenie works yet to modify.

Thanks
Title: Re: X10 using Firecracker CM17A
Post by: jshan on March 06, 2015, 10:57:07 AM
I think adding dimming should be do-able.  I won't be able to get to it for about 6 weeks so if someone else wants to do it... probably requires a different virtual module for a dimmable light, and implementing the command internally which should be easy enough given the commands in the previous post.
Regards,
JohnS
Title: Re: X10 using Firecracker CM17A
Post by: Gene on March 06, 2015, 11:07:01 AM
Hi guys,

wanted to help with this, so I created an homegenie hgx tha does not require any external script installation.
The python code is in the hgx itself and also implement virtual modules for controlling.
The only pre-requisite is to install python-serial:
Code: [Select]
sudo apt-get install python-serial
After importing the script, some parameters can be configured (see attacched screenshot).
Then just add modules to a group and you're ready to control them.

Enjoy,
g.
Title: Re: X10 using Firecracker CM17A
Post by: Gene on March 06, 2015, 11:10:06 AM
P.S. also dimming will work with this new script.
Title: Re: X10 using Firecracker CM17A
Post by: jshan on March 06, 2015, 11:15:05 AM
Thanks Gene!
Title: Re: X10 using Firecracker CM17A
Post by: ebasta on March 07, 2015, 04:53:36 AM
Thank you, Gene!!!

It seems to go into an endless loop while dimming!  I am going to stretch my skills and look for the issue :)
Title: Re: X10 using Firecracker CM17A
Post by: Gene on March 08, 2015, 02:36:49 PM
Hi ebasta,

tried to fix the issue. Let me know if it's working now (the program name has changed too).

g.
Title: Re: X10 using Firecracker CM17A
Post by: ebasta on March 09, 2015, 02:15:06 AM
Hi Gene,

Everything seems to working perfectly now - I will test all week and see if anything comes up - thank you!!!
Title: Re: X10 using Firecracker CM17A
Post by: ebasta on March 12, 2015, 07:05:19 AM
Hi Gene,

I have had success if I leave all modules as "SWITCH"es.  But changing some modules to "DIMMERS" - after dimming and brightening modules the script seems to freeze after a while and slows down the server.  I would then have to reboot.
Title: Re: X10 using Firecracker CM17A
Post by: Gene on March 12, 2015, 03:35:14 PM
Hi ebasta,

cannot help much on this without the cm17a, hope some of you will be able to debug and fix it.
Share any fix here, so I can update the program (that is now included in hg >= r483).

Cheers,
g.
Title: Re: X10 using Firecracker CM17A
Post by: bkenobi on March 12, 2015, 03:44:34 PM
Did you check to see if the issue is with HG or the original script?  It sounded like Gene basically copied the original Python script into HG, so if there's some kind of a memory leak in the code itself it's likely in the HG script as well.  Perhaps run the script outside of HG in a loop to simulate your issue in HG and watch the process with "top" to see if the script is eating memory or CPU cycles over time.
Title: Re: X10 using Firecracker CM17A
Post by: ebasta on March 12, 2015, 07:16:54 PM
Thank you @bkenobi @Gene, I'll run some loops and see what happens.
Title: Re: X10 using Firecracker CM17A
Post by: 99guspuppet on January 26, 2017, 12:55:34 AM
Thanks to all    this has been a great help     Gus