Using RS232 to control an Optoma projector

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

Paste the received result you get here and I’ll have a go at it using the serial and template sensors.

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

Like this:

sensor:
  - platform: serial
    name: My serial receiver
    serial_port: /dev/ttyUSB0

Then template sensors or template binary sensors to parse the state of that sensor. Easier to do once you have some data in the serial sensor.

Calling the update entity service for the serial sensor after calling your shell command may or may not be required.

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:

Well the sensor should log everything.

If you send the command from the cli in home assistant do you get a response?

No I don’t get a response in the SSH terminal within HA although I’m using the same echo command I used to send a command to the screen (with a different hex code) and I didn’t think echo commands showed responses…

Yeah ok.

Are there any terminals installed, picocom, minicom, socat?

If not you could try this:

echo -e -n '\x7E\x30\x30\x30\x30\x20\x31\x0D' > /dev/ttyUSB0 & cat -v < /dev/ttyUSB0

echo command cannot read back the response, check the thread I posted above. I think we discussed it there.

But its true that the sensor should read the response. However, despite what I sent, the sensor remains empty as for you

but I could read the responses with some utilities for hex commands, so the projectors sends back the response on the serial line

Which is why I added this on the end:

... & cat -v < /dev/ttyUSB0

It won’t help with your command, but I wanted to test if you are receiving anything in home assistant. It should redirect the received serial data to the screen.

I receive number of “F” on every row. So there is a development. Expected response should be “Ok1” for powered on “Ok0” for powered off

I get different responses each time i enter the command:

Try that using COOLTERM https://freeware.the-meiers.org/
The author, Roger, was in touch with me over an email and tried to figure out the command. We were not successful, probably due to my limited knowledge, however, I used the utility to be sure the command works as it should. It will shows you the proper returns. I will do the same and we can compare results

Hi, good job getting it done!

I want to do something similar, just for my LED strip.

But I am facing an issue: I want to control the LED strip with commands and need to send them through a serial port, I believe I have a problem with the baud rate, but I have no idea how to set it. Do you have any ideas?

I am running HAOS on an OnLogic CL210G-10.

This is my current config:

switch:
  - platform: command_line
    switches:
      serial_light:
        command_on: echo -n -e '["0666233948a0/led-strip/-/brightness/set", 100]' > /dev/serial/by-id/usb-0403_6015_bc-usb-dongle-r1.0-3e9437b9cd99-if00-port0
        command_off: echo -n -e '["0666233948a0/led-strip/-/brightness/set", 0]' > /dev/serial/by-id/usb-0403_6015_bc-usb-dongle-r1.0-3e9437b9cd99-if00-port0
        friendly_name: Serial Light

light:
  - platform: template
    lights:
      serial_light:
        friendly_name: "Tower Light"
        value_template: "{{ is_state('switch.serial_light', 'on') }}"
        turn_on:
          service: switch.turn_on
          target:
            entity_id: switch.serial_light
        turn_off:
          service: switch.turn_off
          target:
            entity_id: switch.serial_light

Hi Tom,
I have a receiver connected to HA via usb->RS232. The commands I send work as expected.

When I run echo -e -n '\x7E\x30\x30\x30\x30\x20\x31\x0D' > /dev/ttyUSB0 & cat -v < /dev/ttyUSB0 I see status/the commands coming back.

But my sensor

sensor:
  - platform: serial
    baudrate: 9600
    bytesize: 8
    stopbits: 1
    parity: N
    serial_port: /dev/ttyUS0

Simply returns unknown in HA:
image

Do you have any suggestions for what type of entity/configuration I should try to capture the rs232 commands in home assistant?

I nearly have the setup I want (Something like @Vahaldor’s where I can include the on or off state).

Thanks

I have never solved this, to be honest. Just live with the fact that my projector looks turned on when it turnes off automatically, so I click the button twice to turn it on. If you manage to solve it, I will maybe become only five years older to have it done .)