core icon indicating copy to clipboard operation
core copied to clipboard

WAQI sensor isn't loaded during startup after update to 2023.2.5

Open Pirol62 opened this issue 2 years ago • 2 comments

The problem

The WAQI sensors doesn't load during startup

What version of Home Assistant Core has the issue?

2023.2.5

What was the last working version of Home Assistant Core?

2023.1.7

What type of installation are you running?

Home Assistant OS

Integration causing the issue

WAQI

Link to integration documentation on our website

https://www.home-assistant.io/integrations/waqi

Diagnostics information

No response

Example YAML snippet

# Air Quality
- platform: waqi
  token: xxxxxxxxxxxxxxxxxxxxxx
  locations:
    - dusseldorf
    - krefeld

Anything in the logs that might be useful for us?

nothing

Additional information

No response

Pirol62 avatar Feb 27 '23 11:02 Pirol62

Hey there @andrey-git, mind taking a look at this issue as it has been labeled with an integration (waqi) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of waqi can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign waqi Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


waqi documentation waqi source (message by IssueLinks)

home-assistant[bot] avatar Feb 27 '23 11:02 home-assistant[bot]

WAQI sensors are working for me. Looks like you didn't check the logs for errors. Maybe try another restart as there is probably some start up error. Make sure when you file an issue you grab the logs as requested in the template.

dshokouhi avatar Feb 27 '23 15:02 dshokouhi

I am also having issues getting data from the WAQI integration though I'm not sure if my issue is related. It was working for me up until a couple of days ago and I am also on 2023.2.5. Here's the error from my log. I can open a new issue if necessary.

Logger: homeassistant.components.waqi.sensor
Source: components/waqi/sensor.py:88
Integration: waqi (documentation, issues)
First occurred: 11:27:29 AM (64 occurrences)
Last logged: 2:39:01 PM

Failed to connect to WAQI servers
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/waqiasync/__init__.py", line 47, in _get
    resp = yield from self._session.get(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/waqi/sensor.py", line 88, in async_setup_platform
    stations = await client.search(location_name)
  File "/usr/local/lib/python3.10/site-packages/waqiasync/__init__.py", line 32, in search
    return (yield from self._get(SEARCH_URL, keyword=keyword))
  File "/usr/local/lib/python3.10/site-packages/waqiasync/__init__.py", line 46, in _get
    with async_timeout.timeout(self._timeout):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 116, in __exit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

yuejon avatar Feb 27 '23 20:02 yuejon

Ok, I restarted twice now and increased the loglevel for homeassistant before. The error log is the same like @yuejon:

Logger: homeassistant.components.waqi.sensor
Source: components/waqi/sensor.py:88
Integration: waqi (documentation, issues)
First occurred: 07:46:20 (2 occurrences)
Last logged: 07:47:05

Failed to connect to WAQI servers
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/waqiasync/__init__.py", line 47, in _get
    resp = yield from self._session.get(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore[return-value]  # noqa
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/waqi/sensor.py", line 88, in async_setup_platform
    stations = await client.search(location_name)
  File "/usr/local/lib/python3.10/site-packages/waqiasync/__init__.py", line 32, in search
    return (yield from self._get(SEARCH_URL, keyword=keyword))
  File "/usr/local/lib/python3.10/site-packages/waqiasync/__init__.py", line 46, in _get
    with async_timeout.timeout(self._timeout):
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 116, in __exit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.10/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError

Pirol62 avatar Feb 28 '23 06:02 Pirol62

I had also done multiple restarts which didn't fix the issue for me, but it appears to have resolved itself in the middle of the night about 3 hours ago. I'm now getting data from the integration again.

yuejon avatar Feb 28 '23 12:02 yuejon

Seem to work here as well since a view hours.

Pirol62 avatar Feb 28 '23 14:02 Pirol62