I have an RS232 HDMI switcher that I had working fine on my old HASS server, and I recently moved to a new server and I can’t get output from my commands. This probably isn’t specifically a HASS issue but I don’t know where else to turn right now. My new server is running HA OS in a VM on proxmox.
Anyway, when I plug in the USB/serial converter that is attached to the RS232 device, and pass it through to the VM with proxmiox I see that it is recognized and attached to ttyUSB0, which I can see with dmesg
in the terminal:
However, the commands that I have previously used to check the device’s current input or change the input are not working.
I had this setup in Home Assistant:
- platform: command_line
switches:
patio_hdmi_switch:
friendly_name: "Mirror Family Room TV"
icon_template: mdi:content-copy
command_on: >
echo -e -n ">SetVideo 02\r\n" > /dev/ttyUSB0
command_off: >
echo -e -n ">SetVideo 01\r\n" > /dev/ttyUSB0
command_state: >
stty -F /dev/ttyUSB0 raw; echo -e -n ">GetVideo\r\n" > /dev/ttyUSB0; cat /dev/ttyUSB0
value_template: >
{{ true if "02" in states('sensor.patio_hdmi_switch') else false }}
(The command_state
includes the stty setting command because I noticed that sometimes (like after a reboot) the connection would “lose” its settings.)
Now, however, no matter what commands I send, there is no output from the device…until I physically unplug the USB cable. I initially opened two terminals, one to watch for output:
tail -f /dev/ttyUSB0
And one to issue commands. These resulted in no output at all:
echo -e -n ">GetVideo\r\n" > /dev/ttyUSB0
echo -e -n ">SetVideo 02\r\n" > /dev/ttyUSB0
So I messed with this for awhile, and finally in frustration I physically unplugged the USB-to-serial adapter from the server. When I did this, suddenly the terminal with tail -f /dev/ttyUSB0
output something:
02
<Video 02
System
Initialization Finished!
42271T
Version V1.0.1
<Video 02
What we see there are the outputs of my commands and a power-cycle I did on the HDMI switch…none of this output until I physically unplugged the USB adapter.
So…what’s going on here? It seems like the HDMI switch is receiving my commands, and is in fact responding, but I’m not getting the output back? It’s getting buffered somewhere? This is the same configuration — as far as I can tell — that I had working on my previous server. I’m really at a loss for how to troubleshoot this.
The manual for the device in question is here and has its RS232 details starting on page 16.
Possibly a helpful datapoint, I’ve also tried sending the command via Node Read serial-port node and it times out (like it too is not getting any output). Config for that: