Core: 0.91.0 Awair sensor stopped working

Created on 4 Apr 2019  路  12Comments  路  Source: home-assistant/core

Home Assistant release with the issue:
0.91.0

Last working Home Assistant release (if known):
0.90.2

Operating environment (Hass.io/Docker/Windows/etc.):
Docker, Ubuntu server 18.04
arch | x86_64
dev | false
docker | true
hassio | true
os_name | Linux
python_version | 3.7.2
timezone | UTC
version | 0.91.0
virtualenv | false

Component/platform:
Awair Air Quality Monitor
https://www.home-assistant.io/components/awair/

Description of problem:
It is no longer possible to get Co2, VOC, PM2.5, Humid. and Temp. readings from the sensor.
"sensor.awair_co2", ect. is shown as non existing in the HA user interface.

Log details:

Unexpected Awair API error: The query 
Devices {
    devices {
        uuid
        deviceType
        deviceId
        name
        preference
        macAddress
        room {
            id
            name
            kind
            Space {
                id
                kind
                location {
                    name
                    timezone
                    lat
                    lon
                }
            }
        }
    }
} with variables None is invalid.
Platform awair not ready yet. Retrying in 180 seconds

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

sensor:
  - platform: awair
    access_token: [removed]
    devices:
      - uuid: awair-r2_8080

Traceback (if applicable):


Additional information:
It is possible to get air data using awairs request:
https://docs.developer.getawair.com/#operation/getLatestAirDataRoute
for example:

curl -X GET http://developer-apis.awair.is/v1/users/self/devices/awair-r2/8080/air-data/latest -H 'authorization: Bearer {{authtoken}}'

returns:

{"data":[{"timestamp":"2019-04-04T17:44:38.471Z","score":91.0,"sensors":[{"comp":"temp","value":21.56999969482422},{"comp":"humid","value":45.34000015258789},{"comp":"co2","value":734.0},{"comp":"voc","value":284.0},{"comp":"pm25","value":13.0}],"indices":[{"comp":"temp","value":0.0},{"comp":"humid","value":0.0},{"comp":"co2","value":1.0},{"comp":"voc","value":0.0},{"comp":"pm25","value":0.0}]}]}

So it does not look like the Awair service is the problem.

awair

Most helpful comment

See latest comments on the PR- there were technical problems merging it, and it鈥檚 been pushed back until 0.92.

All 12 comments

I am seeing the same thing as well.

I have the same issue, also I'm able to get the response from the webservice myself

It looks like the underlying python_awair library (https://github.com/ahayworth/python_awair/tree/master/python_awair) uses their GraphQL endpoint. If you pull up the endpoint (https://developer-apis.awair.is/graphql - needs Authorization and Content-Type headers set) and try to run the query from the library:

query {
  Devices {
    devices {
        uuid
        deviceType
        deviceId
        name
        preference
        macAddress
        room {
            id
            name
            kind
            Space {
                id
                kind
                location {
                    name
                    timezone
                    lat
                    lon
                }
            }
        }
    }
  }
}

You end up getting the following error:

{
  "data": null,
  "errors": [
    {
      "message": "Cannot query field 'lat' on type 'Location'. (line 49, column 20):\n                  \tlat\n                   ^",
      "locations": [
        {
          "line": 49,
          "column": 20
        }
      ]
    },
    {
      "message": "Cannot query field 'lon' on type 'Location'. (line 50, column 20):\n                  \tlon\n                   ^",
      "locations": [
        {
          "line": 50,
          "column": 20
        }
      ]
    }
  ]
}

However, replacing lat and lon with latitude and longitude (or taking them out entirely), it will work and return the correct data. This is (probably) a recent change in the Awair API that broke, just very coincidentally at the same time as 0.91, and as such, is likely something that needs fixed in the python_awair library, not Home Assistant.

What I'm not certain of is why, if you manually set your devices, https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/awair/sensor.py#L104 isn't just bypassing the call to client.devices() and skipping this error entirely.

Edit: meant 0.91, not 0.90.

We've seen this through many requests on the Awair Team and are looking into anything that we may be able contribute to get everyone back up and running. Any details would be very helpful.

For a temporary fix, I did what @legendblade suggested and renamed lat and lon to latitude and longitude in lib/python3.6/site-packages/python_awair/const.py

I can see my Awair sensors again.

I just issued a pull request in @ahayworth's implementation to fix these issues. Thanks everyone for the debugging!

A very recent change indeed - I restarted my own HA instance only 5 days ago, and it was working then. But, restarting today shows the same symptoms.

I've merged @deanlyoung's PR, and released python_awair 0.0.4. I'll submit a PR to home-assistant shortly to update the version.

Looks like this is targeted for the 0.91.2 release @Runepx4 @john5788 @Jasring @legendblade

Can we confirm that this made it into the Docker image for 0.91.2? I'm seeing the same issue this morning after orobouros updated to the 0.91.2 image, and it looks like /usr/local/lib/python3.7/site-packages/python_awair/const.py contains the old lat/lon code.

Looks like it was removed from the 0.91.2 milestone before it was released. Not sure why, perhaps @pvizeli can comment as to why.

this still isn't fixed in the last version, why is this not included?

See latest comments on the PR- there were technical problems merging it, and it鈥檚 been pushed back until 0.92.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sogeniusio picture sogeniusio  路  3Comments

ofuangka picture ofuangka  路  3Comments

kirichkov picture kirichkov  路  3Comments

missedtheapex picture missedtheapex  路  3Comments

coolriku picture coolriku  路  3Comments