Python Plugin: OpenAQ

Python and python framework

Moderator: leecollings

User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Python Plugin: OpenAQ

Post by FireWizard »

Hi,

@Jan Jansen

You are probably right, as I found that I'm using an older version, which updates every hour and not every minute.
Looked into the source, but except of that line I cannot find anything that indicates the update frequency.

So @Xorfor has to answer this question.

Regards
Xorfor

Re: Python Plugin: OpenAQ

Post by Xorfor »

Fortunately openaq.org allows unlimited requests in their API :) .

Because of a big change in Oct 2019 in the plugin, the self.__MINUTES was not used anymore. I have updated the plugin and implemented this again and now the plugin will update the sensors only once per hour.
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Python Plugin: OpenAQ

Post by Jan Jansen »

@ Xorfor,

Thanks for your time and attention, it works as desired!

Regards
Jan
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Python Plugin: OpenAQ

Post by FireWizard »

@Xorfor,

I have installed the new version and I can confirm that it works as intended.

Regards
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Python Plugin: OpenAQ

Post by rrozema »

(Air quality) openaq returned a status: 504
It has been doing this since yesterday. It's probably them having an issue, not a problem of the plugin.
User avatar
FireWizard
Posts: 1745
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Python Plugin: OpenAQ

Post by FireWizard »

Hi,

I think, it is an incident, as I saw it only once in the log:
2020-11-23 21:29:33.373 Error: (Air Quality) openaq returned a status: 504
From: https://developer.mozilla.org/en-US/doc ... Status/504
The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.
Regards
rrozema
Posts: 470
Joined: Thursday 26 October 2017 13:37
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Delft
Contact:

Re: Python Plugin: OpenAQ

Post by rrozema »

FireWizard wrote: Tuesday 24 November 2020 14:59 Hi,

I think, it is an incident, as I saw it only once in the log:
2020-11-23 21:29:33.373 Error: (Air Quality) openaq returned a status: 504
From: https://developer.mozilla.org/en-US/doc ... Status/504
The HyperText Transfer Protocol (HTTP) 504 Gateway Timeout server error response code indicates that the server, while acting as a gateway or proxy, did not get a response in time from the upstream server that it needed in order to complete the request.
Regards
I agree that it is probably an incident at their side, and as such it will probably go away once they discover there's a problem in their server(s). However, it is happening every +- 5 minutes in my log, so that's why I wanted to share this to let others know it is not just them ;-). I also see 503 errors every now and then.
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: OpenAQ

Post by waltervl »

Seems that Xorfor was so nice to update the plugin yesterday to the new OpenAq V2 Api. I just tried and it seems to work. I get measurements but have to wait 1 hour to see if they update....

So in the plugin folder of OpenAQ do a git pull and it should work again after an update of the OpenAQ Hardware in Domoticz.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Python Plugin: OpenAQ

Post by Derik »

Hi... looks the plugin is gone on git..
Only after a new setup in domoticz is in my db the plugin "working"...
And i cannot remove the plugin because he is not there..
Some a solution?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: OpenAQ

Post by waltervl »

I am currently updating this plugin as it now needs an API key to get the data. It is testing at the moment. I will report back when it is working properly...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5148
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Python Plugin: OpenAQ

Post by waltervl »

It is running now for some hours, everything seems to be OK.
So the modified fork is here:
https://github.com/waltervl/Domoticz-OpenAQ-Plugin

To update from the old plugin
1. Edit the config file in the .git folder of the plugin and change the url from Xorfor into waltervl

Code: Select all

url = https://github.com/waltervl/Domoticz-OpenAQ-Plugin.git
2. Do a "git pull" in the plugin folder to update the plugin.
3. Register on OpenAQ and get your API KEY from https://explore.openaq.org/account.
4. Restart Domoticz
5. Go to menu Setup - Hardware, select the plugin hardware gateway and add the API KEY to the OpenAQ plugin configuration.
6. Click on Update. Now the plugin will start and succeeds to login and update the existing devices.

Alternative for step 1 and 2 is to go to the github repository, copy the contents of the plugin.py and paste it into the plugin.py of your Domoticz server and so overwiting is contents.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest