Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CM17A firecracker support fails/crashes #2

Open
clach04 opened this issue Jul 9, 2016 · 2 comments
Open

CM17A firecracker support fails/crashes #2

clach04 opened this issue Jul 9, 2016 · 2 comments

Comments

@clach04
Copy link

clach04 commented Jul 9, 2016

I tweaked/hacked the sample/demo in the tests demo to help with cross platform testing:

# https://github.com/glibersat/python-x10
from x10.controllers.cm17a import CM17a

serial_port_name = '/dev/ttyUSB'
serial_port_name = 'com11'

unit = 'A1'
unit = 'C6'

dev = CM17a(serial_port_name)
dev.open()

livinglamp = dev.actuator(unit)

livinglamp.on()

dev.close()

It fails with the following traceback:

abstract - 2016-07-09 12:37:29,289 DEBUG Writing 0xd5aa
Traceback (most recent call last):
  File "test_serial.py", line 19, in <module>
    livinglamp.on()
  File "C:\Users\clach04\py\x10\python-x10\x10\devices\actuators.py", line 22, in on
    self.x10ctrl.do(functions.ON, self.x10addr)
  File "C:\Users\clach04\py\x10\python-x10\x10\controllers\cm17a.py", line 114, in do
    self.write(self.DATA_HDR) # Send data header
  File "C:\Users\clach04\py\x10\python-x10\x10\controllers\abstract.py", line 111, in write
    self._handle.write(chr(aSequence))
ValueError: chr() arg not in range(256)

which is correct, chr() expects a single character, maybe this should be an aSequence.encode('latin1')?

This was with Windows and Python 2.7 but I don't think the platform/version have an impact.

As an FYI I've had success with the following firecracker (specific) modules under Linux and Windows:

clach04 referenced this issue Jul 9, 2016
…rollers.

Remove some CM15 specific code, in favor of a more generic mechanism.
@glibersat
Copy link
Owner

Hi @clach04,

First, thanks for you feedback. You're right, this chr doesn't make sense if used on a sequence. This code was added by a contributor but I couldn't get a chance to try it on a firecracker.

Maybe you can try either to:

  1. replace this call by looping over the sequence and transforming each byte with a chr()
  2. do the same as in the UsbX10Controller class (see https://github.com/glibersat/python-x10/blob/master/x10/controllers/abstract.py#L159)

If you need some assistance, feel free to ask, I'd be glad to have someone test this package against a real firecracker and confirm it's working.

Cheers,

Guillaume

@clach04
Copy link
Author

clach04 commented Jul 12, 2016

I was able to successfully use http://www.averdevelopment.com/python/x10.html and https://bitbucket.org/cdelker/python-x10-firecracker-interface/ for CM17A control. The later is more pythonic in method naming (pep8) and under source code control but the first one has more features (e.g. all on/off support) and can work under Python 3.

I'm not likely to get around to hacking on this further as things are working for me in https://github.com/clach04/x10_rest. I'm certainly happy for you to ping me if you want a tester,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants