more G-Labs products

Author Topic: X10 using Firecracker CM17A  (Read 4959 times)

December 10, 2014, 06:19:51 AM
Read 4959 times

jshan

  • ***
  • Information
  • Full Member
  • Posts: 71
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/
- 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

February 17, 2015, 11:44:59 AM
Reply #1

gwhip70

  • *
  • Information
  • Newbie
  • Posts: 1
Awesome, worked perfectly.

March 06, 2015, 09:17:17 AM
Reply #2

ebasta

  • *
  • Information
  • Newbie
  • Posts: 12
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

March 06, 2015, 10:57:07 AM
Reply #3

jshan

  • ***
  • Information
  • Full Member
  • Posts: 71
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

March 06, 2015, 11:07:01 AM
Reply #4

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.

March 06, 2015, 11:10:06 AM
Reply #5

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
P.S. also dimming will work with this new script.

March 06, 2015, 11:15:05 AM
Reply #6

jshan

  • ***
  • Information
  • Full Member
  • Posts: 71

March 07, 2015, 04:53:36 AM
Reply #7

ebasta

  • *
  • Information
  • Newbie
  • Posts: 12
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 :)

March 08, 2015, 02:36:49 PM
Reply #8

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
Hi ebasta,

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

g.

March 09, 2015, 02:15:06 AM
Reply #9

ebasta

  • *
  • Information
  • Newbie
  • Posts: 12
Hi Gene,

Everything seems to working perfectly now - I will test all week and see if anything comes up - thank you!!!

March 12, 2015, 07:05:19 AM
Reply #10

ebasta

  • *
  • Information
  • Newbie
  • Posts: 12
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.

March 12, 2015, 03:35:14 PM
Reply #11

Gene

  • *****
  • Information
  • Administrator
  • Posts: 1472
  • Tangible is the future!
    • Yet Another Programmer
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.

March 12, 2015, 03:44:34 PM
Reply #12

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.

March 12, 2015, 07:16:54 PM
Reply #13

ebasta

  • *
  • Information
  • Newbie
  • Posts: 12
Thank you @bkenobi @Gene, I'll run some loops and see what happens.

January 26, 2017, 12:55:34 AM
Reply #14

99guspuppet

  • *
  • Information
  • Newbie
  • Posts: 1
Thanks to all    this has been a great help     Gus