michaelahern / homebridge-airthings

A Homebridge plugin for Airthings air quality monitors via the Airthings Consumer API.
ISC License
38 stars 6 forks source link

AirThings Business Hub #20

Closed kishtsang closed 6 months ago

kishtsang commented 2 years ago

Dear Michael,

Very interesting solution you have come up with! I'm currently using a View Plus Business together with a Hub, despite your instructions I can't get any data from the api. I'm constantly getting

2-8-2022 17:15:04Airthings BridgeAirthingsERRORResponse Error: 400 Bad Request

errors. Do you know if the Business API is different from the consumer API?

Thanks,

Kishan

michaelahern commented 1 year ago

Kishan,

I think this is likely due to the Airthings for Business API using a different OAuth token scope, read:device, instead of the Consumer API, which uses read:device:current_values. Seems like the Consumer API doesn't let you read historical values, only current values, hence the difference.

I just released v0.8.0, which adds support for customizing the token scope via a new optional tokenScope config key. Can you try setting this to read:device and check if that causes the Business API to work?

Thanks, Mike