-
Notifications
You must be signed in to change notification settings - Fork 19
Add support for tcp forwarded serial ports #176
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
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #176 +/- ##
==========================================
- Coverage 96.69% 96.60% -0.10%
==========================================
Files 7 7
Lines 908 912 +4
==========================================
+ Hits 878 881 +3
- Misses 30 31 +1
Continue to review full report at Codecov.
|
Is this It's sort of documented in the ZHA docs (https://www.home-assistant.io/integrations/zha/#zigate-or-sonoff-zbbridge-devices), but only in the ZiGate section. |
It is required. This does not use PySerial but pyserial-asyncio and a wrapper is required even for ZiGate. The implementation of ZiGate is quite similar to what I did. |
The 2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.uart] Connection made
2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.api] Command Command.device_state (0, 0, 0)
2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.uart] Send: 0x0702000800000000
2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.uart] Frame received: 0x0702000800a20000
2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.api] Device state response: [<DeviceState.128|APSDE_DATA_REQUEST_SLOTS_AVAILABLE|2: 162>, 0, 0]
2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.api] Network state transition: OFFLINE -> CONNECTED
2021-12-20 13:13:36 DEBUG (MainThread) [zigpy_deconz.uart] Closed serial connection zigpy-znp supports Ethernet coordinators that also use a TCP-serial proxy and it needs no special code to do this. I'm not sure why the zigpy-zigate has that code either. I think the pyserial-asyncio code is generic enough to not care about the underlying transport, it just adapts pyserial to work with the asyncio event loop. Its source code does explicitly mention sockets so I think it's not merely working by accident: class SerialTransport(asyncio.Transport):
"""An asyncio transport model of a serial communication channel.
A transport class is an abstraction of a communication channel.
This allows protocol implementations to be developed against the
transport abstraction without needing to know the details of the
underlying channel, such as whether it is a pipe, a socket, or
indeed a serial port. ^^^^^^^^
""" |
All radios use pyserial-asyncio which is a wrapper around ptserial. |
Nice, works for me as well. Due to the ZHA documentation I checked the I'd suggest to revert this MR. |
This reverts commit 22f07a4.
Revert "Add support for tcp forwarded serial ports (#176)"
This allows users to connect to deCONZ Zigbee radio devices that are forwarded via network e.g. with
ser2net
orsocat
by specifying a custom path in the format tcp://host:port.Tested and working for 2 weeks over a VPN connection. Daily disconnections by the ISP, short-term high latency and other connections issues did not cause any major issues.
If this is accepted, I can add instructions and a working configuration example to the documentation.