HomeGenie Forum
Automation Program Plugins and Wizard Scripting => APP Contributions => Topic started 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
-
Awesome, worked perfectly.
-
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
-
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
-
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:
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.
-
P.S. also dimming will work with this new script.
-
Thanks Gene!
-
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 :)
-
Hi ebasta,
tried to fix the issue. Let me know if it's working now (the program name has changed too).
g.
-
Hi Gene,
Everything seems to working perfectly now - I will test all week and see if anything comes up - thank you!!!
-
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.
-
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.
-
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.
-
Thank you @bkenobi @Gene, I'll run some loops and see what happens.
-
Thanks to all this has been a great help Gus