Add support for named serial ports, e.g. p = pylights.plm('/dev/ttyUSB0')
My python is pretty weak so if you decide to apply the patch, please feel free to tweak it however you like first.
support named serial ports
Thanks Brad. The new version is in the repository. I have no convenient way of testing this so if you don't mind...
Bryon, thank you for incorporating the change. Works great!
I tested by replacing my patched pylights.py with your latest version (SVN r2) and issuing a few commands in the REPL:
brad@sheevaplug:/tmp/insteon$ python Python 2.6.5+ (release26-maint, Jul 7 2010, 00:21:05) [GCC 4.4.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pylights >>> pylights.device_cfg_filename = './devices.xml' >>> p = pylights.plm('/dev/ttyUSB0') >>> p.setLevel('test_lamp', 100) 'OK'
[lamp turns on]
>>> p.setLevel('test_lamp', 0) 'OK'
[lamp turns off]
Also, judging by serialwin32.py in pySerial, you should be able to use:
pylights.plm('COM1')
in place of:
pylights.plm(0)
to test on Win32 platforms. YMMV though; I have not tested that yet and I may be mis-reading the pySerial source code.
Thanks again!
--Brad
Log in to post a comment.
support named serial ports
Thanks Brad.
The new version is in the repository. I have no convenient way of testing this so if you don't mind...
Bryon, thank you for incorporating the change. Works great!
I tested by replacing my patched pylights.py with your latest
version (SVN r2) and issuing a few commands in the REPL:
brad@sheevaplug:/tmp/insteon$ python
Python 2.6.5+ (release26-maint, Jul 7 2010, 00:21:05)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylights
>>> pylights.device_cfg_filename = './devices.xml'
>>> p = pylights.plm('/dev/ttyUSB0')
>>> p.setLevel('test_lamp', 100)
'OK'
[lamp turns on]
>>> p.setLevel('test_lamp', 0)
'OK'
[lamp turns off]
Also, judging by serialwin32.py in pySerial, you should be able
to use:
pylights.plm('COM1')
in place of:
pylights.plm(0)
to test on Win32 platforms. YMMV though; I have not tested that
yet and I may be mis-reading the pySerial source code.
Thanks again!
--Brad