-
Notifications
You must be signed in to change notification settings - Fork 11
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
API endpoint changing per PurpleAir #35
Comments
Unfortunate for us, this breaks the plugin entirely. It is a big issue. |
You can sidestep the issue entirely with HTTP Advanced Accessory. Your PurpleAir Sensor has on it a website which provides a JSON file; using HTTP Advanced Accessory, you can extract the raw values from your PurpleAir Sensor and expose them to HomeKit that way. It is unaffected by the API changeover, and the traffic is local within your home network (so you're never in danger of annoying PurpleAir with too many API requests). I've shared the code I use to do it here, on another PurpleAir plugin that has also been deactivated by this problem. As I note in there though, this will give you two sensors that each provide a verbal air quality, a PM2.5, and a PM10 reading, not a single sensor; I haven't worked out any way to combine the A and B sensor outputs into a single averaged reading. My code bases the air quality reading off the PM2.5 reading. |
Thanks for sighting this issue. I was wondering why this plugin stopped working :( |
I will spend some time reviewing the other patch and updating the plugin after Data and AI Summit later this month! |
@rxin Any update to addressing this issue? Thanks! |
Folks, here's a small update. I have just released a version 1.7.0 of this plugin which contains a workable solution similar to what @nashnix provided above, but more native - if you own your PurpleAir sensor, you can make this plugin talk directly to it over the local network instead of hitting internet API. Just configure the plugin's new However, I will work on supporting the new public API, stay tuned. |
Thanks. That works nicely. I always thought there should be an http/json server on board the PurpleAir, but never guessed the address as ipaddress/json. Thanks to nashnix for that! |
Have you been able to work out how to use the new public API yet? Our air quality here in NorCal is TERRIBLE and I miss having that info in HomeKit for my automatons. Thank you for your hard work! |
We forked this repo and someone added local access. It's working great now. Hate these fires though! |
Thanks @roycepope, but I'm trying to use the public API to pull from a web-based sensor, I don't actually own any myself. The 'HTTP Advanced Accessory' info above is a bit beyond my skill level unfortunately. I was able to get a public API 'read' and 'write' key from PurpleAir by e-mailing them, and can pull data from public sensors using curl 'GET' requests in terminal. Wondering if the plugin is able to support this yet. |
For local access, I found that uninstalling the plugin and then reinstalling it fixed local access. |
Switching from the deprecated JSON endpoint to the new API. This addresses #35 Note: to use the new API users now need to request dedicated (read) API keys. This key needs to be added to the plugin config, unless you're using local sensors directly (using the sensor's IP address). See these resources for more information: https://community.purpleair.com/t/discontinuation-of-the-json-and-data-json-urls/713 https://api.purpleair.com/#api-welcome https://community.purpleair.com/t/making-api-calls-with-the-purpleair-api/180/1
Folks, please try out the new v2.0.0 which has support for the new purpleair.com API. Reach out to [email protected] to request your (read) API key, and configure it in the new version of the plugin. Open issue for any unexpected behavior, thank you! |
As of today, the endpoint http://www.purpleair.com/json is no longer in service.
https://community.purpleair.com/t/discontinuation-of-the-json-and-data-json-urls/713
PurpleAir is changing to a new API as mentioned here:
https://community.purpleair.com/t/purpleair-data-migration-to-bigquery-and-a-new-api/295
One can register for an API key by emailing PurpleAir Support [email protected]
The API for a sensor seems to have changed from
https://www.purpleair.com/json?show=61037
to
https://api.purpleair.com/v1/sensors/61037
where
61037
is the sensor id of interest.The return payload has slightly changed as well.
Example return payload
The text was updated successfully, but these errors were encountered: