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

NameError when connection is lost via UPnP #133

Open
mareksmid opened this issue Feb 8, 2024 · 0 comments
Open

NameError when connection is lost via UPnP #133

mareksmid opened this issue Feb 8, 2024 · 0 comments

Comments

@mareksmid
Copy link

When my LinkPlay device is powered off, and the connection from Home Assistant is not possible anymore, this library wants to display the warning message at

"Failed communicating with LinkPlayDevice (UPnP) '%s': %s", self._name, type(error)

however it gives a NameError instead, as the error variable is not defined:

2024-02-07 06:53:15.769 ERROR (MainThread) [homeassistant.helpers.entity] Update for media_player.wa_250 fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/async_upnp_client/aiohttp.py", line 98, in async_http_request
    resp_body = await response.read()
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1100, in read
    self._body = await self.content.read()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 373, in read
    block = await self.readany()
            ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 395, in readany
    await self._wait("readany")
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 301, in _wait
    with self._timer:
  File "/usr/local/lib/python3.11/site-packages/aiohttp/helpers.py", line 735, in __exit__
    raise asyncio.TimeoutError from None
TimeoutError

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

Traceback (most recent call last):
  File "/config/custom_components/linkplay/media_player.py", line 639, in async_update
    self._upnp_device = await self._factory.async_create_device(url)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/async_upnp_client/client_factory.py", line 72, in async_create_device
    root_el = await self._async_get(description_url)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/async_upnp_client/client_factory.py", line 394, in _async_get
    ) = await self.requester.async_http_request("GET", url)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/async_upnp_client/aiohttp.py", line 117, in async_http_request
    raise UpnpConnectionTimeoutError(repr(err)) from err
async_upnp_client.exceptions.UpnpConnectionTimeoutError: [Errno TimeoutError()] None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 898, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1216, in async_device_update
    await self.async_update()
  File "/config/custom_components/linkplay/media_player.py", line 642, in async_update
    "Failed communicating with LinkPlayDevice (UPnP) '%s': %s", self._name, type(error)
                                                                                 ^^^^^
NameError: name 'error' is not defined
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

1 participant