Hardware for connecting an RS232 serial device to wifi

Check your homeassistant logs - that’ll probably have more information on why it can’t connect.

Connection refused. Wondering if that’s the connection to esp-link.

Logger: custom_components.benqprojector.config_flow
Source: custom_components/benqprojector/config_flow.py:163
integration: BenQ Projector (documentation, issues)
First occurred: 19:49:44 (7 occurrences)
Last logged: 20:10:18

Unexpected exception: [Errno 111] Connection refused
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/benqprojector/benqconnection.py", line 212, in open
    connection = telnetlib.Telnet(self._host, self._port, _TELNET_TIMEOUT)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/telnetlib.py", line 221, in __init__
    self.open(host, port, timeout)
  File "/usr/local/lib/python3.12/telnetlib.py", line 238, in open
    self.sock = socket.create_connection((host, port), timeout)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 852, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.12/socket.py", line 837, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/benqprojector/config_flow.py", line 163, in async_step_setup_network
    info = await self.validate_input_setup_network(user_input, errors)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/benqprojector/config_flow.py", line 204, in validate_input_setup_network
    if not await self.hass.async_add_executor_job(projector.connect):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/benqprojector/benqprojector.py", line 264, in connect
    if not self._connect():
           ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/benqprojector/benqprojector.py", line 253, in _connect
    self._connection.open()
  File "/usr/local/lib/python3.12/site-packages/benqprojector/benqconnection.py", line 217, in open
    raise BenQConnectionError(str(ex)) from ex
benqprojector.benqconnection.BenQConnectionError: [Errno 111] Connection refused

Yes it is.


A bit confused about the 8000 here…is that a port number?

Esp-Link is hardcoded to use port 23 which is the default port for telnet.
You can also use the secondary port 2323. :thinking:

I have made the esp-link installer available on the web, and for my purposes i recompiled it to use port 23 and 2000 (as my application is stuck on 2000) :wink:

1 Like

The instructions say to enter the serial port and baud rate not an IP address.

It’s a bit confusing…It does describe how to set up a direct serial port, but not how to use a serial bridge…

However, it does seem to support it:

Home Assistant BenQ projector integration

Home Assistant integration that supports sending commands to BenQ projectors over the serial interface or serial to network bridges like esp-link.

PS, Searched some more and came up with these:

But I am not sure you can use socat on HAOS :thinking: PJLink shouldn’t be an issue though :wink:

@nickrout
It is very confusing, as his currernt configuration does seem to understand it needs to use a telnet connection :thinking:

So maybe it is either serial port + baudrate or ip-address + port ?

edit…just checked the source, and indeed it accept both serial port + baudrate as well as ip-address + port:

    conf_type = CONF_TYPE_SERIAL
    if CONF_TYPE in entry.data:
        conf_type = entry.data[CONF_TYPE]

    if conf_type == CONF_TYPE_TELNET:
        host = entry.data[CONF_HOST]
        port = entry.data[CONF_PORT]

        # Test if we can connect to the device.
        projector = BenQProjectorTelnet(host, port)

        # Open the connection.
        if not await hass.async_add_executor_job(projector.connect):
            raise ConfigEntryNotReady(f"Unable to connect to device {host}:{port}")
    else:
        serial_port = entry.data[CONF_SERIAL_PORT]
        baud_rate = entry.data[CONF_BAUD_RATE]

        # Test if we can connect to the device.
        try:
            projector = BenQProjectorSerial(serial_port, baud_rate)

So I guess if he changes the 8000 to 23 (or 2323), it should work :ok_hand:

That seems to make sense.

It also seems we miss the first screenshot :smiley:
image

With this one, everything makes sense :thinking:

Serial:
image

Network:
image

1 Like

Perhaps someone should submit a PR for the readme.

1 Like

I used your tool to flash esp-link! You made it very easy :slight_smile:

When ports are auto-filled, I typically defer to the default. When I get home I’ll try 23, then try 2323 if that fails. Fingers crossed :smiley:

Indeed, the instructions could use some clarification. Once I get everything settled here, I’ll submit a readme PR to clarify what’s needed for others in the future.

Hehe…that was they general idea behind it, good to know it works!!
:smiley:

if you are using mine the port are 23 and 2000 (i changed the port as the app i use is stuck on port 2000 )

Using port 23 got me a step further. It seems to have found esp-link but is now having issues connecting to the projector.

Logger: benqprojector.benqprojector
Source: /usr/local/lib/python3.12/site-packages/benqprojector/benqprojector.py:277
First occurred: 09:57:08 (4 occurrences)
Last logged: 10:01:17

Failed to get projector command prompt, is your projector properly connected?

I swapped the TX & RX pins, tried again, and got the same error. Same with trying port 2000. All attempts were made with the projector powered on.

i’ve read somewhere the projector’s network should be in standby mode

(whatever that means…i don’t have one)

and port 23 and 2000 are the same, so it doesn’t matter which one you use :wink:

Tried again with the projector in standby mode, same result:

Logger: benqprojector.benqprojector
Source: /usr/local/lib/python3.12/site-packages/benqprojector/benqprojector.py:277
First occurred: 09:57:08 (7 occurrences)
Last logged: 19:48:54

Failed to get projector command prompt, is your projector properly connected?

Here are my pin connections. I’ve tried swapping TX/RX on the 8266 with the same result:

In the esp-link settings, I enabled SLIP for serial connections and have MQTT disabled. Do I need MQTT enabled? What should I try next?

Sorry…can’t be of much further help here (as I don’t own a Benq Projector)

But I am pretty sure SLIP needs to be disabled; it only allows the board to initiate a connection.
And Benq uses a TelNet connection, initiated from HA.
Also MQTT is not used.

You could try some different GpIO settings:
image
These are for my ESP01-s, which I use with my PelletStove,
Not sure exactly what settings to use for your ESP12-F :thinking:

I disabled SLIP and tried again with the same results. I also attempted using each of the pre-set profiles, once with UART normal and once reversed.

I went through the projector settings again and couldn’t find anything about enabling or disabling RS232. Enabling the 12v trigger didn’t change anything, as expected.

All of this is with TX wired to esp RX, and RX wired to esp TX.

Kinda feels like I’m missing a step somewhere. Is there config I need to apply to the serial bridge uC? Or settings/config for esp-link that tells it how to communicate with the projector? Unplugging the uC from the 8266 yields the same error message I keep seeing in the HASS logs:

Failed to get projector command prompt, is your projector properly connected?

I’m drawing a blank on troubleshooting next steps. Any ideas?

What is the baudrate?

according benq it should be 9600…

And just out of curiosity, it doesn’t have a lan connection?

1 Like

Projector default is 115200. I tried adjusting it to 9600 in the projector settings, no success. That said, the baud rate in esp-link is fixed at 115200, so it’s unclear if changing the value in my projector’s settings is even capable of having an impact on its own. How would I adjust this in esp-link?

It doesn’t have a discrete network connection. The projector comes with a BenQ-branded Android TV stick that can be installed in a dedicated HDMI port underneath (requires removing the case to install). The stick enables plug-and-play streaming like most smart TVs these days, but the setup process requires linking a Google account and still doesn’t provide projector controls. I don’t want my projector communicating with anything beyond my local network — a sentiment I suspect most people on this board share :grinning:

Hmm…the link I saw it was 9600, but could be 115200…as said, I’m stumbling i the dark here, just trying to think along, but don’t have a projector myself :thinking:

You can adjust it in the console (as well as stop bits and parity)

1 Like