To anyone who tries this and fails (like I just did). You must use double quotes when you want ESPHome’s uart component to interpret special charaters in the data field correctly. This is explained here. And yes, you find this out using the method that tom_l suggested.
I have tested the code below and it works with an Epson EMP-TW700 projector. It should work with any ESP/VP21 protocol projector (as e.g. listed here)
Also, I suggest adding assumed_state: True to the switch. This is the correct way of handling switches that do not have a feedback. The switch icon becomes a lightning bolt, and you can turn the projector on or off multiple times without having to toggle the switch (e.g. when you forget to switch on the mains or you use the remote as well).
With the code below, the LED on the MAX3232 flashes when I turn the switch on/ off from HA. But the projector (Epson Home Cinema 3200) does not respond. So I guess the communication upto the projector is ok? Unable to think of what to do next.
I also tried hooking my PC with Putty on it to the projector. I connected a USB TTL device to my laptop. Tx to the MAX3232 Rx and vice versa. Selected my COM port and opened the putty window but the blank putty window that opened wouldnt let me type anything into it.
How should I troubleshoot? The putty window opens but there is no prompt, nothing. Nothing can be typed into the window either. Tried using another USB TTL device too. Same thing.
I bought the cable (though not costing 40 bucks like the one in your link)
Seems to detect on the port just fine. But the result is the same, a cursor in the window which I cant type anything into. This time im using teraterm instead of putty.
I am trying something similar at the moment. I hooked up the UART of my ESP32 to an MAX3232 based TTL-RS232 Converter. Unfortunateley the projector is not reacting on any commands. I though can receive messages when turning on the projector with the remote.
I hooked up my oscilloscope to the Converter and can confirm that the RS232 Converter is working flawlessly. I think the problem is the MAX3232 with its +/-5.4V output levels as classical RS232 has +/-12-ish V Levels. So the projectos RS232 Controller may not correctly detect HIGH and LOW Levels. Maybe its also a bit luck regarding tolerances in the projectors RS232 controller and the MAX2323. This would explain why it’s working for some and for some dont. Also it would explain why I can receive but not transmit.