core: airvisual exception on hass start

Home Assistant release with the issue:

.77.3

Last working Home Assistant release (if known): N/A

Operating environment (Hass.io/Docker/Windows/etc.):

virtualenv on ubuntu 16.04 with python 3.6 Component/platform:

sensor/airvisual

Description of problem: When hass starts, airvisual throws an exception

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

- platform: airvisual
  api_key: foobar
  monitored_conditions:
    - us

Traceback (if applicable):

2018-09-15 17:40:42 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform airvisual
Traceback (most recent call last):
  File "/home/hass/automation/hass/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
    return fut.result()
  File "/home/hass/automation/hass/lib/python3.6/site-packages/homeassistant/components/sensor/airvisual.py", line 155, in async_setup_platform
    await data.async_update()
  File "/home/hass/automation/hass/lib/python3.6/site-packages/homeassistant/components/sensor/airvisual.py", line 283, in _async_update
    self.pollution_info = resp['current']['pollution']
KeyError: 'pollution'

Additional information:

Noted my key was expired, so i had to delete it and create a new community key. It has been a while since i did anything directly with hass configuration.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (10 by maintainers)

Most upvoted comments

And this is what I get for Denver

{
    "status": "success",
    "data": {
        "city": "Denver",
        "state": "Colorado",
        "country": "USA",
        "location": {
            "type": "Point",
            "coordinates": [
                -105.00523,
                39.7794
            ]
        },
        "current": {
            "weather": {
                "ts": "2018-09-17T19:00:00.000Z",
                "hu": 2,
                "ic": "01d",
                "pr": 1019,
                "tp": 30,
                "wd": 130,
                "ws": 3.1
            }
        }
    }
}

Think I will email them tomorrow and inquire what is going on with their API - the code is good itโ€™s just their API causing this issue.

@bachya That is really weird. The iOS app works fine on my phone and I get 3 local stations but the API via Postman only gives me the same one as you but without the Pollution ๐Ÿ‘Ž