8000 Use with rfc2217... small change required · Issue #1 · etsinko/pymonoprice · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use with rfc2217... small change required #1

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

Open
abarbaccia opened this issue Jul 8, 2018 · 4 comments
Open

Use with rfc2217... small change required #1

abarbaccia opened this issue Jul 8, 2018 · 4 comments

Comments

@abarbaccia
Copy link
abarbaccia commented Jul 8, 2018

Hi thanks for the code. In my setup I have my home assistant box far from the amp. As a workaround I connect a rpi to the amp, and create an rfc2217 service to expose the serial port over tcp (there is a very simple server script in the pyserial docs that you can run as-is).
The monoprice home assistant component should be able to take a url as “rfc2217:\\ip:port”. The hangup is with pymonoprice, around line 190 in init where we define a write timeout. This does not exist for rfc2217 and it errors out. If I comment that line out, everything works fine and I can control my amp from home assistant (via the Pi over tcp!)
Any way to put a condition around that one line? Right now I stopped updating my ha container because it keeps requiring me to change the file again. Thanks!!

@etsinko
Copy link
Owner
etsinko commented Jul 8, 2018

Should be easy enough. Feel free to create a pull request. I will look at it this week!

@abarbaccia
Copy link
Author
abarbaccia commented Jul 8, 2018 via email

@etsinko
Copy link
Owner
etsinko commented Jul 11, 2018

@abarbaccia can you please provide me with a stack trace? I checked the pyserial sources and noticed that rfc2217 implementation has both timeout and write_timeout.
In my case pymonoprice failed when I actually tried opening the port at line 194:

def __init__(self, port_url):
self._port = serial.serial_for_url(port_url, do_not_open=True)
self._port.baudrate = 9600
self._port.stopbits = serial.STOPBITS_ONE
self._port.bytesize = serial.EIGHTBITS
self._port.parity = serial.PARITY_NONE
self._port.timeout = TIMEOUT
self._port.write_timeout = TIMEOUT
self._port.open()

@abarbaccia
Copy link
Author
abarbaccia commented Jul 11, 2018 via email

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
0