Hi folks,
I saw several threads about this topic but none address the problem directly. HA has a clear working integration SERIAL for listening of commands on serial port when they are sent by a sensor. However, there is non similarly focused simple way how to send commands over a serial port to the device.
Optoma, as any other manufacturer with RS232 interface, has a table of commands I can use. What is the most direct way to send these commands to the projector from HA that I can configure in simple yaml to have various buttons in my lovelace? Thanks!
I haven’t worked out the details yet but I plan to use an ESP32 running ESPHome connected to my Epson projector’s serial port via a MAX3223 line driver/receiver IC (3.3v <> RS232). You can buy these modules for $5 on ebay / aliexpress with or without the DB9 socket.
You can create UART switches in ESPhome to send your commands.
When switched on they each write data to the UART and you can then use the “on_turn_on” trigger to switch each switch off again, ready for the next trigger. If you leave the switch on it cant trigger again (I think, needs testing).
If you need feedback, there are UART text sensors you could use or you could publish the received serial data to an mqtt topic.
I bought usb>DB9 cable that has some common device address such as /ttyUSB0 in HA as my Conbee stick for zigbee. It looks to me quite straitforward than buying another board beside my rapsberry. This guy solved the problem but not as straitforward as I would expect it can be done
Tom, it looks that usb<>rs232 is unnecessary problem on the way as it has some FTDI or PL2303 chipset, which work differently etc… I tried to send some commands from PC or OSX to projector with no success. Even Optoma support recommends using crossover rs232 cable to be sure, its simply raw transmission.
Could you please point me on exact produdct I can plug to my Raspberry PI running HA that would have RS232 connector ready for the crossover cable?
SOLVED:
And it’s definitely the most straightforward approach in comparison to discussions I met here.
As Tom above argues, of course the USB>RS232 worked. Tom Thanks!. Be careful, my problem was in Big Sur that has some bug that causes sending only two characters instead of the whole hex, so Mac OS Big Sur is not proper OS for testing. Windows needed some drivers. HA running on RP4 works like a charm. I used coolterm for testing from OSx, that worked once probably because of the bug (bug was identified by the author of coolterm app who helped me as well, thanks Roger!)
How I made it working:
USB<>RS232 has an address visible in supervisor/three dots/hardware, my address is /dev/ttyUSB0
Ask your company for correct hex commands. I found two lists using google on the Optoma website which were both wrong. Support sent me the correct list.
I tested the shell command in HA terminal, worked so
I edited configuration.yaml to add a service that runs the shell command:
Hey! Great you got it working. Not sure how I missed this update.
I’ve been doing a bit more reading and while still using the ESP32 (my home assistant is on a different floor to the projector) I’m going to use user defined api calls instead of uart switches. Then publish to the uart with an automation in esphome.
Hey, was there any additional configuration you had to put into Home Assistant to get the shell command working via buttons? The above shell command works great when executed through the SSH Terminal but wont work when through the shell command service set up in the configuration.yaml file and UI button.
How much it took you to make it working? I spent about 40hrs on this easy setup to finally control my projector.
However, I still dont know how to read the response to check whether my input boolean is in a correct state. If you can spend some time on it, I will be glad!
My projector has a 12V output that switches on and off with the projector. It’s meant to trigger motorised screens but I plan to use it as state feedback for power. Worth checking if yours has this too. One resistor divider to get a 3.3V signal into the ESP and you’re done.
I have 12V output jack and use it for the screen as well. I thought that reading the state using the hw I already installed would be just fine .) I haven’t played with ESP yet but still, I just have some setup that should be able to work. I tried serial sensor but probably did not figure out the command properly. The sensor never received the data.
I’ve got the necessary hex command that should return a different hex string to state whether the screen/object is on or off, but i dont know how to parse that in a sensor by reading the return via command line
I don’t have anything returned at the moment. I know the hex command I need to send in order to get the relevant reply, but I can’t get any reply atm.
My current write commands (turn screen on and off) use echo like the examples above but my understanding is that echo won’t get any response. I don’t know how to parse the hex code request using HA terminal/shell command to get a reply which we can then parse into a template
I tried this but with no success, please, check my other topic I opened on this problem (send shell hex command to receive a response on a serial sensor integration):
@tom_l I have set up that serial configuration already. From your response am I to understand that I then need to call a shell command manually to generate the sensor information? Sorry for the potential stupid question.
I’ve set up two sensors both of which don’t seem to give any data back: