0

I have a ventilation unit (Zehnder Comfoair) that is communicating with a control panel using RS-232. I am able to control the unit with Node-Red on my Rapsberry Pi if I connect the ventilation unit to the Pi instead of to the control panel. Now I would like to control the unit with both the panel and the Pi so I think I need a kind of serial port multiplexer as shown in the sketch below. Is there any utility that is already doing this? If not, do you have any advice on how to do it, preferably in shell or Python?

Serial port multiplexer

EDIT 20200126: Thanks @Marco G. I succeeded in connecting both in parallel. I used node-red and a Bash script. I have the control panel (ComfoSense) connected to ttyUSB0 and the ventilation unit to ttyUSB1 through RS232-USB converters. They are both configured the same way (stty -F /dev/ttyUSB0 raw 9600 cs8, same for ttyUSB1) and they are both linked together with socat (socat /dev/ttyUSB0 /dev/ttyUSB1) so I can use the control panel. The Comfoair node is communicating with a virtual serial port (/home/pi/VMC/ttyV0) that I link to the ventilation unit (socat PTY,link=/home/pi/VMC/ttyV0 /dev/ttyUSB1) only when I want to send a command. During that time the control panel cannot communicate but that is not a problem it is only for a short time.

mifrey
  • 1
  • 2
  • what did you try till now? – DeshDeep Singh Dec 05 '19 at 11:02
  • I have not tried anything yet since I think some utilities might already exist. – mifrey Dec 05 '19 at 11:07
  • You have the solution on your sketch. If you can control de unit from your node red script you just need to read the commands from the external control panel and forward them through the output port. You can do it in node red, Python or a shell script. Maybe you can show your node red code to start with – Marcos G. Dec 05 '19 at 12:27
  • You have some ideas to start with [here](https://www.google.com/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/4029255/how-do-i-bridge-two-physical-serial-ports-to-each-other-in-software-and-log-the&ved=2ahUKEwiasp6Hxp7mAhUJ8BQKHVdKBaEQjjgwBXoECAkQAQ&usg=AOvVaw2N1ZaWkbWRrYmuFvBqar84) and [here](https://www.google.com/url?sa=t&source=web&rct=j&url=https://stackoverflow.com/questions/19231465/how-to-make-a-serial-port-sniffer-sniffing-physical-port-using-a-python&ved=2ahUKEwjxrY7Xxp7mAhWJ8eAKHZxlB8o4FBAWMAF6BAgJEAE&usg=AOvVaw2iiUYiTQrmD1szI9gdpddh). You can also look at *cat* – Marcos G. Dec 05 '19 at 12:55
  • And also *socat* – Marcos G. Dec 05 '19 at 12:56

0 Answers0