Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration crashes after beamer being powered off / unreachable for a longer time #24

Open
DaKue77 opened this issue Jan 7, 2025 · 22 comments

Comments

@DaKue77
Copy link

DaKue77 commented Jan 7, 2025

Hi,

I love this integration and how it eases my interaction with my Benq Beamer (w4000i/ht4550i).

One annoying thing is that the integration does seem to crash after the Beamer is powered off and not reachable via Network anymore.

Situation:
I have my Benq W4000i/HT4550i connected to the network. It has an integrated LAN port. It is being discovered by the Benq integration and can be controlled properly. I have configured a fixed IP address, but did also try DHCP before.
During night I power off my hole theater including the Beamer via an external power switch.

Expected behavior:
As for all other devices and integrations I use, I expect the Benq integration to automatically discover the Beamer once it is network reachable again.

Actual Behavior:
In opposite to all the other devices, the Beamer does not get available again (Status: Not available). The Benq integration seems to have crashed an can only be reactivated by completely restarting Home Assistant.

Error log:

Warning Message:

Logger: benqprojector.benqprojector
Quelle: runner.py:154
Erstmals aufgetreten: 6. Januar 2025 um 20:04:10 (165 Vorkommnisse)
Zuletzt protokolliert: 02:01:14

Timeout while waiting for response

Error message:

Logger: benqprojector.benqprojector
Quelle: /usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py:579
Erstmals aufgetreten: 02:01:19 (1 Vorkommnisse)
Zuletzt protokolliert: 02:01:19

Unexpected error

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 522, in _read_coroutine
    if await self.update_power():
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 1124, in update_power
    response = await self.send_command("pow")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 830, in send_command
    response = await self._send_command(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
        BenQCommand(command, action), check_supported
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 618, in _send_command
    await self._send_raw_command(command.raw_command)
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 782, in _send_raw_command
    await self.connection.write(f"{command}\r".encode("ascii"))
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 149, in write
    await self._writer.drain()
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 374, in drain
    raise exc
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1005, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] Host is unreachable
@DaKue77 DaKue77 changed the title Integration crashes after beamer being powered off / unreachable Integration crashes after beamer being powered off / unreachable for a longer time Jan 7, 2025
@rrooggiieerr
Copy link
Owner

Hi @DaKue77, thank you for your kind words regarding my integration. I don't own a networked projector myself, so am dependent on community feedback like yours if things don't work.

So with powered off you mean taking the power off the projector right? Not powering off as in putting in stand-by.

@DaKue77
Copy link
Author

DaKue77 commented Jan 7, 2025

Hi @rrooggiieerr ,

yes, this is really a very useful integration and I am happy to help out with any feedback I can provide. :)

Indeed, I mean taking off the power from the projector. I have a wireless power plug in front of the beamer that I am remotely switching off.

When putting the projector simply into stand-by I did not encounter any issues so far, but I can test it during the upcoming nights by leaving the beamer in stand-by without taking off the power - just to make sure.

EDIT: One other point - so far the issue was on 2024.12, today I updated to 2025.1.1, so I will also test behaviors on this version now.

@rrooggiieerr
Copy link
Owner

I suspect reloading the device makes your projector work again?

Screenshot 2025-01-07 at 14 53 22

@rrooggiieerr
Copy link
Owner

rrooggiieerr commented Jan 7, 2025

Your issue looks very much like #23, did you upgrade to HA Core 2025.1? And did the integration still work on HA Core 2024.12?

@DaKue77
Copy link
Author

DaKue77 commented Jan 7, 2025

I suspect reloading the device makes your projector work again?

Screenshot 2025-01-07 at 14 53 22

Reloading asks for restarting HA and yes, after restarting HA it works again.

Your issue looks very much like #23, did you upgrade to HA Core 2025.1? And did the integration still work on HA Core 2024.12?

Agree, but since the issue #23 was referring to an issue introduced with 2025.1. Since I observed my issue with 2024.12, I did choose to create a separate issue. You can of course merge these issues.

As written above, today I updated to 2025.1 (45 mins ago) so I will now re-check for the behavior.

@rrooggiieerr
Copy link
Owner

Reloading asks for restarting HA and yes, after restarting HA it works again.

I wasn't expecting you were asked to restart HA, than it's quite severe. Does it ask this when the projector is off power, or also on power but stand-by?

@DaKue77
Copy link
Author

DaKue77 commented Jan 7, 2025

I just tried.

Summary: while running and in stand-by, I can reload without rebooting. When I put it off power, it will not reload throwing an error. Turing power on again and having the device in stand-by again, will allow to reload the device without a HA restart.

To me it looks like the reload forcing me to restart HA is connected to the initial issue that occurres after several hours of disconnection. I will now be out for some hours and leave the device in stand-by. Just to check whether the issue will also occur after some hours on stand-by.

Details:
While the projector is running, I can successfully reload the device without restarting. I then put the projector into stand-by, waited for the status to turn to "off" and tried to reload the device.

First try, following errors occurred:

Logger: benqprojector.benqconnection
Quelle: /usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py:70
Erstmals aufgetreten: 15:12:32 (4 Vorkommnisse)
Zuletzt protokolliert: 15:35:33

Connection error
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 68, in close
    await self._writer.wait_closed()
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 358, in wait_closed
    await self._protocol._get_close_waiter(self)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1005, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 104] Connection reset by peer

and

Logger: homeassistant.config_entries
Quelle: config_entries.py:640
Erstmals aufgetreten: 15:35:33 (1 Vorkommnisse)
Zuletzt protokolliert: 15:35:33

Error setting up entry BenQ W4000I for benqprojector
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 68, in close
    await self._writer.wait_closed()
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 358, in wait_closed
    await self._protocol._get_close_waiter(self)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1005, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
ConnectionResetError: [Errno 104] Connection reset by peer

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/benqprojector/__init__.py", line 249, in async_setup_entry
    if not await projector.connect(interval=interval):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 369, in connect
    self.has_prompt = await self._detect_prompt()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 643, in _detect_prompt
    response = await self.connection.read(10)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 100, in read
    raise BenQConnectionError(ex.strerror) from ex
benqprojector.benqconnection.BenQConnectionError: Connection reset by peer

Now the beamer is not reachable though in stand-by. The integration shows this status:

image

Translated it should mean "config error" or "set-up error" and "check protocols".

Reloading it again would correct the issue and the beamer is available again.

Second try, I waited for a minute after the beamer was put into stand-by. No issues. So I think I was a bit too quick with reloading the device, even though the status turned to "off" already. I am still providing this feedback for completeness.

Third try, off power:

Logger: homeassistant.config_entries
Quelle: config_entries.py:640
Erstmals aufgetreten: 15:48:58 (1 Vorkommnisse)
Zuletzt protokolliert: 15:48:58

Error setting up entry BenQ W4000I for benqprojector
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        lambda: protocol, host, port, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1136, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
        exceptions, addrinfo, laddr_infos)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1039, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 222, in open
    self._reader, self._writer = await asyncio.wait_for(
                                 ^^^^^^^^^^^^^^^^^^^^^^^
        asyncio.open_connection(self._host, self._port), timeout=10
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 506, in wait_for
    async with timeouts.timeout(timeout):
               ~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/timeouts.py", line 116, in __aexit__
    raise TimeoutError from exc_val
TimeoutError

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/benqprojector/__init__.py", line 249, in async_setup_entry
    if not await projector.connect(interval=interval):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 357, in connect
    if not await self._connect():
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 339, in _connect
    await self.connection.open()
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 228, in open
    raise BenQConnectionTimeoutError(str(ex)) from ex
benqprojector.benqconnection.BenQConnectionTimeoutError

Turning the power on and bringing the beamer back to stand-by again will allow to reload the device and make the beamer available again.

@rrooggiieerr
Copy link
Owner

Thanks for the thorough testing. Will look into it further at a later moment.

As a workaround you could create an automation that reloads the device after the smartplug is powered on.

Screenshot 2025-01-07 at 16 01 30

@DaKue77
Copy link
Author

DaKue77 commented Jan 7, 2025

Good idea - I'll try and see whether this would allow a reload without a HA restart.

@DaKue77
Copy link
Author

DaKue77 commented Jan 8, 2025

Hi @rrooggiieerr ,

I am back again with another test result. This night I completely turned off power again and after approx. 1h this error occurred again, this time on HA version 2025.1.1:

Logger: benqprojector.benqprojector
Quelle: /usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py:579
Erstmals aufgetreten: 01:06:42 (1 Vorkommnisse)
Zuletzt protokolliert: 01:06:42

Unexpected error
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 522, in _read_coroutine
    if await self.update_power():
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 1124, in update_power
    response = await self.send_command("pow")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 830, in send_command
    response = await self._send_command(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
        BenQCommand(command, action), check_supported
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 620, in _send_command
    raw_response = await self._read_raw_response(command)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 726, in _read_raw_response
    elif (response := await self._read_response()) == "":
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 688, in _read_response
    _response = await self.connection.readuntil(self._separator)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 129, in readuntil
    return await asyncio.wait_for(
           ^^^^^^^^^^^^^^^^^^^^^^^
        self._reader.readuntil(separator), timeout=self._read_timeout
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 677, in readuntil
    await self._wait_for_data('readuntil')
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 539, in _wait_for_data
    await self._waiter
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1005, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] Host is unreachable

I also tried to reload the device via the automation - this is the result:

Logger: homeassistant.config_entries
Quelle: config_entries.py:855
Erstmals aufgetreten: 16:01:09 (1 Vorkommnisse)
Zuletzt protokolliert: 16:01:09

Error unloading entry BenQ W4000I for benqprojector
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 855, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/benqprojector/__init__.py", line 308, in async_unload_entry
    await coordinator.async_disconnect()
  File "/config/custom_components/benqprojector/__init__.py", line 151, in async_disconnect
    await self.projector.disconnect()
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 476, in disconnect
    await self._disconnect()
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 470, in _disconnect
    await self.connection.close()
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 68, in close
    await self._writer.wait_closed()
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 358, in wait_closed
    await self._protocol._get_close_waiter(self)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1005, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] Host is unreachable

A second device device entry was created by the automation and both are not available:

image

In addition I am not able to reload the device via the GUI anymore:
image

After restarting HA, the newly created device is available again, but the initial one not. So I have to relink it now to all the existing rooms and scripts and I wonder how to remove the first one.

@rrooggiieerr
Copy link
Owner

Thanks! I'm working on hardening the underlaying library to be able to handle these errors, how comfortable are you with testing my Python code from the command line?

@rrooggiieerr
Copy link
Owner

I'm also trying to understand why you get the error after about an hour. Does your DHCP lease time happen to be one hour?

@DaKue77
Copy link
Author

DaKue77 commented Jan 8, 2025

I feel comfortable to test from the command line, happy to help.

DHCP was also the first thing that came up to my mind, so I already changed the projector's network configuration to static. I do not expect any issues related to networking. I do have other devices being switched off together with the projector, that are on the same network even with DHCP, still they re being recognized again by their integrations, once up again. (an AVR, a BD Player and a Android TV Player).

@rrooggiieerr
Copy link
Owner

I made changes to the underlaying python library, could you give these a try?

Please modify the requirements of the custom_components/benqprojector/manifest.json to link to benqprojector@git+https://github.com/rrooggiieerr/benqprojector.py.git like so:

{
  "domain": "benqprojector",
  "name": "BenQ Projector",
  "codeowners": [
    "@rrooggiieerr"
  ],
  "config_flow": true,
  "documentation": "https://github.com/rrooggiieerr/homeassistant-benqprojector",
  "integration_type": "device",
  "iot_class": "local_polling",
  "issue_tracker": "https://github.com/rrooggiieerr/homeassistant-benqprojector/issues",
  "loggers": [
  	"benqprojector"
  ],
  "requirements": [
    "benqprojector@git+https://github.com/rrooggiieerr/benqprojector.py.git"
  ],
  "version": "0.1.2"
}

And restart your HA afterwards

@DaKue77
Copy link
Author

DaKue77 commented Jan 15, 2025 via email

@DaKue77
Copy link
Author

DaKue77 commented Jan 19, 2025

Hey @rrooggiieerr ,

I did as requested, unforatunately still the same error after exactly 2h:

Logger: benqprojector.benqprojector
Quelle: /usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py:579
Erstmals aufgetreten: 19:07:37 (1 Vorkommnisse)
Zuletzt protokolliert: 19:07:37

Unexpected error
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 522, in _read_coroutine
    if await self.update_power():
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 1124, in update_power
    response = await self.send_command("pow")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 830, in send_command
    response = await self._send_command(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
        BenQCommand(command, action), check_supported
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 618, in _send_command
    await self._send_raw_command(command.raw_command)
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 782, in _send_raw_command
    await self.connection.write(f"{command}\r".encode("ascii"))
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 149, in write
    await self._writer.drain()
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 374, in drain
    raise exc
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 1005, in _read_ready__data_received
    data = self._sock.recv(self.max_size)
OSError: [Errno 113] Host is unreachable

This seems to happen after the runner retried for approx 2h and afterwards the runner also stops:

Logger: benqprojector.benqprojector
Quelle: runner.py:154
Erstmals aufgetreten: 17:07:34 (138 Vorkommnisse)
Zuletzt protokolliert: 19:07:32

Timeout while waiting for response

@rrooggiieerr
Copy link
Owner

I was expecting something else. Did you restart HA after making the changes? No typo's? In case of a typo HA will write an error in the log file and keep using the previous version of the library.

@DaKue77
Copy link
Author

DaKue77 commented Jan 21, 2025

I did a copy & paste and this is how the changes look like:

{
  "domain": "benqprojector",
  "name": "BenQ Projector",
  "codeowners": [
    "@rrooggiieerr"
  ],
  "config_flow": true,
  "documentation": "https://github.com/rrooggiieerr/homeassistant-benqprojector",
  "integration_type": "device",
  "iot_class": "local_polling",
  "issue_tracker": "https://github.com/rrooggiieerr/homeassistant-benqprojector/issues",
  "loggers": [
    "benqprojector"
  ],
  "requirements": [
    "benqprojector@git+https://github.com/rrooggiieerr/benqprojector.py.git"
  ],
  "version": "0.1.2"
}

I did restart HA and there were no typo related errors.

Also, when the error occurs and I simply restart HA with projector still externally powered off and without reloading the devices there is following error in the HA log:

Logger: homeassistant.config_entries
Quelle: config_entries.py:640
Erstmals aufgetreten: 12:09:38 (1 Vorkommnisse)
Zuletzt protokolliert: 12:09:38

Error setting up entry BenQ W4000I for benqprojector
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 640, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/benqprojector/__init__.py", line 249, in async_setup_entry
    if not await projector.connect(interval=interval):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 357, in connect
    if not await self._connect():
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqprojector.py", line 339, in _connect
    await self.connection.open()
  File "/usr/local/lib/python3.13/site-packages/benqprojector/benqconnection.py", line 222, in open
    self._reader, self._writer = await asyncio.wait_for(
                                 ^^^^^^^^^^^^^^^^^^^^^^^
        asyncio.open_connection(self._host, self._port), timeout=10
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/asyncio/tasks.py", line 507, in wait_for
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        lambda: protocol, host, port, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1161, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1136, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
        exceptions, addrinfo, laddr_infos)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1039, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.187.58', 8000)

What I can also see is warning log entries related to blocked messages:

Logger: benqprojector.benqprojector
Quelle: runner.py:154
Erstmals aufgetreten: 12:17:39 (203 Vorkommnisse)
Zuletzt protokolliert: 12:30:41

Command *pp=?# blocked item
Command *ltim=?# blocked item
Timeout while waiting for response

and

Dieser Fehler stammt von einer benutzerdefinierten Integration

Logger: benqprojector.benqprojector
Quelle: custom_components/benqprojector/__init__.py:249
Integration: BenQ Projector (Dokumentation, Probleme)
Erstmals aufgetreten: 12:17:38 (4 Vorkommnisse)
Zuletzt protokolliert: 12:25:56

No command echo received
Command *macaddr=?# blocked item

In addition I observed that if I restart first, I can then afterwards just reload the devices without forcing me to restart once more.

So in summary:
After the error occured, I have to restart HA to get it working. I also need to reload the devices of your integration. If I reload right away, it will force me to restart HA. If I first restart HA, it will simply reload the devices.

BTW: There is regularly a second device created with same name but without room assigned. I still try to figure out, why this happens just once with a second device, but I never saw a third one... will further observate.

@rrooggiieerr
Copy link
Owner

Looking at the logging I can see my modifications are not used and an older version of the library is still used. Can you send the home-assistant.log file? The first 100 lines will do.

Blocked items usually happen when the projector is starting up or shutting down. They are warnings not errors. Generally not something to be worried about.

@DaKue77
Copy link
Author

DaKue77 commented Jan 21, 2025

that's strange...

please find the log file attached.
home-assistant.log

The script errors in the log are also related to the benq integration, since the projector device is regularly being recreated after reboot ... I always need to amend the scripts afterwards. Though this might only happen, if the initial device is mapped to a room. Still trying to nail it.

I'll also restart the whole container and see whether it will pick up your changes.

@DaKue77
Copy link
Author

DaKue77 commented Jan 22, 2025

I got news: After rebooting the container yesterday, the error didn't occur this night. So things worked as expected. I will give it a few more tries and report back afterwards.

@rrooggiieerr
Copy link
Owner

@DaKue77 I'm looking forward to the results of your tests, I hope all problems are resolved.

In the meantime, could I ask you to share the MAC address of your projector? I'm trying to figure out if there is a specific MAC range that BenQ uses on the integrated network interfeces so I can implement auto configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants