Didier,

Thanks for the quick response!

In the weewx.conf, I have the aeris ID and Secret defined, along with 
aqi_enabled = 1, and my lat & long defined.

I'm a newbie to python (I'm a PM and look to my tech resources in my 
professional life), thus appreciate you patience.    I've pulled up 
belchertown.py in my editor, but cannot find any references to aqi (I'm 
running weewx 4.4 and Belchertown 1.2, with Python3 on a Pi 4) -- do I need 
to add code for aqi?  if so what exactly needs to be added and where in 
belchertown.py?

My initial understanding would be to add the following:

aqi = 0   #This equates to the overall air quality?
aqi_category = ""   #Leaving this undefined does not equate to any 
pollutant?
aqi_time = 0   #This equates to the period reflected back by the json?
aqi_location = ""  #Leaving this undefined allows for the default location 
reported by the json?

aqi_url = 
"https://api.aerisapi.com/airquality/45.349518,%20-122.823247?&format=json&client_id=RPt5vXyj9IavCW5i7hvwY&client_secret=CLIENT_SECRET";
   
#I would add the CLIENT_SECRET for my aeris account

If the above doesn't generate results, alter the aqi parameters I'm 
defining in belchertown.py to try the alternatives you suggested?

Can you confirm my understanding and advise accordingly?

FYI -- I'm too 'cheap' to acquire a Purple Air -- the DEQ Air Quality 
station is roughly 3km from home.

Thanks!

-- Tim




On Friday, February 12, 2021 at 7:36:44 AM UTC-8 didier....@gmail.com wrote:

> Hi Tim
> Here is my configuration
>
> *In weewx.conf:*
> only aqi_enabled=1
> Id and secret are in 2 parameters forecast_api_id and forecast_api_secret
> My location is in 2 parameters longitude and latitude
>
> *In belchertown.py:*
> aqi = 0
> aqi_category = ""
> aqi_time = 0
> aqi_location = ""
>
> and
>             aqi_url = (
>                 "
> https://api.aerisapi.com/airquality/%s,%s?&format=json&client_id=%s&client_secret=%s
> "
>                 % (latitude, longitude, forecast_api_id, 
> forecast_api_secret)
>
> and
>             try:
>                 aqi = data["aqi"][0]["response"][0]["periods"][0]["aqi"]
>                 aqi_category = 
> data["aqi"][0]["response"][0]["periods"][0]["category"]
>                 aqi_dominant = 
> data['aqi'][0]['response'][0]['periods'][0]['dominant']
>                 aqi_time = 
> data["aqi"][0]["response"][0]["periods"][0]["timestamp"]
>                 aqi_location = 
> data["aqi"][0]["response"][0]["place"]["name"].title()
>
>  As I said in issue #498 (
> https://github.com/poblabs/weewx-belchertown/issues/498) closest method 
> does not work.
>
> Didier
>
> Le ven. 12 févr. 2021 à 15:12, tim lambert <timsl...@comcast.net> a 
> écrit :
>
>> Didier,
>>
>> I killed the test account -- but it did resolve, as does my Production 
>> account url.  Attached is json from the Production account.
>>
>> My primary question is which parameter would I associate the valid Aeris 
>> AQI url in the weewx.conf?  I have the aqi_enabled set to 1, however I'm 
>> uncertain which parameter needs to have the URL set.   Should the URL be 
>> associated with aqi_location_enabled?   These are the only two AQI related 
>> parameters that I can ascertain.
>>
>>
>> On Friday, February 12, 2021 at 3:25:28 AM UTC-8 didier....@gmail.com 
>> wrote:
>>
>>> Your Id and secret are not valid...
>>>
>>> {"success":false,"error":{"code":"invalid_client","description":"The client 
>>> provided is invalid."},"response":[]}
>>>
>>>
>>> Le ven. 12 févr. 2021 à 02:02, tim lambert <timsl...@comcast.net> a 
>>> écrit :
>>>
>>>> Vince,
>>>>
>>>> The URL is a test account -- I have another Production account.   
>>>> Thanks for the concern.
>>>>
>>>> I have the aqi_enabled set to 1, however I'm uncertain which parameter 
>>>> needs to have the URL set.   Should the URL be associated with 
>>>> aqi_location_enabled?   These are the only two AQI related parameters that 
>>>> I can ascertain.
>>>>
>>>> Thanks in Advance!
>>>>
>>>> - Tim
>>>>
>>>>
>>>>
>>>> On Thursday, February 11, 2021 at 4:47:33 PM UTC-8 vince wrote:
>>>>
>>>>> You really shouldn't post your Aeris private API key and 
>>>>> secret.....I'd suggest you change them and disable the old one.
>>>>>
>>>>> Parameters are under 
>>>>> https://github.com/poblabs/weewx-belchertown#forecast-options
>>>>>
>>>>>
>>>>> On Thursday, February 11, 2021 at 3:47:50 PM UTC-8 tim lambert wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Two questions on this topic:
>>>>>>
>>>>>> 1.  Which config parameter(s) did you use to set the aeris url for 
>>>>>> the Belchertown skin?  In my case:  
>>>>>> https://api.aerisapi.com/airquality/45.349518,-122.823247?&format=json&client_id=RPt5vXyj9IavCW5i7hvwY&client_secret=BQEa1WWhdpGBk9jRNwTO9jKy0yp0WTkVJTicZOpp
>>>>>>  
>>>>>> which does resolve with information
>>>>>>
>>>>>> 2.  Has the issue you reported been resolved?
>>>>>>
>>>>>> Thanks in advance.
>>>>>>
>>>>>
>>>>>> On Thursday, February 4, 2021 at 11:38:58 PM UTC-8 joh....@gmail.com 
>>>>>> wrote:
>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I have the same issue. but no solution so far
>>>>>>> ord...@billandcorena.com schrieb am Dienstag, 26. Januar 2021 um 
>>>>>>> 18:06:56 UTC+1:
>>>>>>>
>>>>>>>> Hi what would be causing all this as I get a good webpage to 
>>>>>>>> display after each update but with this in log every loop?????
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>> an 26 08:22:02 
>>>>>>>>
>>>>>>>> raspberrypi weewx[22225] INFO weewx.restx: Wunderground:Posting not 
>>>>>>>> enabled. Jan 26 08:22:02 raspberrypi weewx[22225] INFOweewx.restx: 
>>>>>>>>
>>>>>>>> PWSweather: Posting not enabled. Jan 26 08:22:02 raspberrypi 
>>>>>>>> weewx[22225]INFO weewx.restx: 
>>>>>>>>
>>>>>>>> CWOP: Posting not enabled.
>>>>>>>>
>>>>>>>> Jan 26 08:22:02 raspberrypi weewx[22225] INFO weewx.restx: WOW: 
>>>>>>>> Posting not enabled. Jan 26 08:22:02 raspberrypi weewx[22225] INFO 
>>>>>>>> weewx.restx:
>>>>>>>>
>>>>>>>> AWEKAS: Posting not enabled. Jan 26 08:22:02 raspberrypi 
>>>>>>>> weewx[22225] INFO __main__: Starting up weewx version 4.3.0 Jan 26 
>>>>>>>> 08:22:03 
>>>>>>>> raspberrypi weewx[22225] INFO weewx.engine: Clock error is 3.18 
>>>>>>>> seconds 
>>>>>>>> (positive is fast) Jan 26 08:22:03 raspberrypi weewx[22225] INFO
>>>>>>>>
>>>>>>>> weewx.engine: Using binding 'wx_binding' to database 'weewx.sdb' 
>>>>>>>> Jan 26
>>>>>>>>
>>>>>>>> 08:22:03 raspberrypi weewx[22225] INFO weewx.manager: Starting 
>>>>>>>> backfill of daily summaries Jan 26 08:22:05 raspberrypi weewx[22225] 
>>>>>>>> INFO
>>>>>>>>
>>>>>>>> weewx.engine: Starting main packet loop. Jan 26 08:25:14 
>>>>>>>> raspberrypi weewx[22225] INFO weewx.manager: Added record 2021-01-26 
>>>>>>>> 08:25:00 MST
>>>>>>>>
>>>>>>>> (1611674700) to database 'weewx.sdb' Jan 26 08:25:14 raspberrypi 
>>>>>>>> weewx[22225] INFO weewx.manager: Added record 2021-01-26 08:25:00 MST
>>>>>>>>
>>>>>>>> (1611674700) to daily summary in 'weewx.sdb' Jan 26 08:25:17 
>>>>>>>> raspberrypi weewx[22225] INFO weewx.cheetahgenerator: Generated 8 
>>>>>>>> files for 
>>>>>>>> report SeasonsReport in 1.77 seconds Jan 26 08:25:17 raspberrypi 
>>>>>>>> weewx[22225] INFO weewx.imagegenerator: Generated 15 images for report 
>>>>>>>> SeasonsReport in 0.67 seconds Jan 26 08:25:17 raspberrypi weewx[22225] 
>>>>>>>> INFO 
>>>>>>>> weewx.reportengine: Copied 5 files to /var/www/html/weewx Jan 26
>>>>>>>>
>>>>>>>> 08:25:17 raspberrypi weewx[22225] INFO user.belchertown: version 
>>>>>>>> 1.2 Jan 26 08:25:17 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error 
>>>>>>>> getting AQI from Aeris weather. The error was:#012list index out of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=*******************
>>>>>>>>
>>>>>>>> Jan 26 08:25:18 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=*********************
>>>>>>>>
>>>>>>>> getting AQI from Aeris weather. The error was:#012list index out of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:19 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=**********************
>>>>>>>>
>>>>>>>> Jan 26 08:25:19 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=*************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:19 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=*****************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:19 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=********************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:20 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=********************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:20 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=*********************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:20 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=dgm******************************
>>>>>>>>
>>>>>>>> Jan 26 08:25:20 raspberrypi weewx[22225] ERROR user.belchertown: 
>>>>>>>> Error getting AQI from Aeris weather. The error was:#012list index out 
>>>>>>>> of 
>>>>>>>> range#012The response from the Aeris AQI server was:#012[{'success':
>>>>>>>>
>>>>>>>> True, 'error': {'code': 'warn_no_data', 'description': 'Valid 
>>>>>>>> request.
>>>>>>>>
>>>>>>>> No results available based on your query parameters.'}, 'response':
>>>>>>>>
>>>>>>>> []}]#012The URL being used
>>>>>>>>
>>>>>>>> is:#012
>>>>>>>> https://api.aerisapi.com/airquality/closest?p=42.8375,-103.0094&format=json&radius=50mi&limit=1&client_id=*******************
>>>>>>>>
>>>>>>>> Jan 26 08:25:21 raspberrypi weewx[22225] INFO 
>>>>>>>> weewx.cheetahgenerator:
>>>>>>>>
>>>>>>>> Generated 11 files for report Belchertown in 3.76 seconds Jan 26
>>>>>>>>
>>>>>>>> 08:25:21 raspberrypi weewx[22225] INFO weewx.reportengine: Copied 
>>>>>>>> 37 files to /var/www/html/weewx/belchertown Jan 26 08:30:14 
>>>>>>>> raspberrypi 
>>>>>>>> weewx[22225] INFO weewx.manager: Added record 2021-01-26 08:30:00 MST
>>>>>>>>
>>>>>>>> (1611675000) to database 'weewx.sdb' Jan 26 08:30:14 raspberrypi 
>>>>>>>> weewx[22225] INFO weewx.manager: Added record 2021-01-26 08:30:00 MST
>>>>>>>>
>>>>>>>> (1611675000) to daily summary in 'weewx.sdb' Jan 26 08:30:15 
>>>>>>>> raspberrypi weewx[22225] INFO weewx.cheetahgenerator: Generated 8 
>>>>>>>> files for 
>>>>>>>> report SeasonsReport in 0.74 seconds Jan 26 08:30:16 raspberrypi 
>>>>>>>> weewx[22225] INFO weewx.imagegenerator: Generated 15 images for report 
>>>>>>>> SeasonsReport in 0.66 seconds Jan 26 08:30:16 raspberrypi weewx[22225] 
>>>>>>>> INFO 
>>>>>>>> weewx.reportengine: Copied 0 files to /var/www/html/weewx
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "weewx-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to weewx-user+...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/weewx-user/a37bfb29-3878-49ee-9c56-781ee322d9fbn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/weewx-user/a37bfb29-3878-49ee-9c56-781ee322d9fbn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
>>>
>>> -- 
>>> Quel temps fait-il à Auffargis <https://meteo-auffargis.decoodt.eu> ?
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "weewx-user" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to weewx-user+...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/weewx-user/85c74592-9f28-4aa5-a9ec-17ed19961245n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/85c74592-9f28-4aa5-a9ec-17ed19961245n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> -- 
> Quel temps fait-il à Auffargis <https://meteo-auffargis.decoodt.eu> ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to weewx-user+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/865b1714-747c-42fd-a9e4-3a5813a333b7n%40googlegroups.com.

Reply via email to