I had to push version but the solution is pretty easy. You can download the 
new version from 
https://github.com/jonathankoren/weewx-aqi/archive/v1.1.0.tar.gz

You can either reinstall the whole thing, but the two files that got 
modified were service.py and calculators.py, so you can just drop those in 
if you want. Nothing else changed beyond the README.md . 

Inside your skin.conf you'll need to add a new SearchList:

[CheetahGenerator]
    search_list_extensions = user.aqi.service.AqiSearchList


Then, inside your index.html.tmpl. you can use the new $aqi template to get 
the color and description out.


The AQI value (e.g. "9"): 
$current($data_binding='aqi_binding').aqi_pm2_5

The AQI category: 

$aqi($current($data_binding='aqi_binding').aqi_pm2_5_category).category


The AQI category's color in hex:

$aqi($current($data_binding='aqi_binding').aqi_pm2_5_category).color;



Putting everything together, you can do something like:

<div style="text-align: center; background-color: 
#$aqi($current($data_binding='aqi_binding').aqi_pm2_5_category).color;" >
    $current($data_binding='aqi_binding').aqi_pm2_5 <br/>
    $aqi($current($data_binding='aqi_binding').aqi_pm2_5_category).category
</div>


Sorry this took a code change, but your email did give the motivation I 
needed to fix this.

I guess, I should wrap up the EU AQI calculator, even if I'm having trouble 
getting it to download CAMS data to fill in missing values.

On Friday, May 31, 2019 at 1:00:36 AM UTC-7, jonathan koren wrote:
>
>
> Honestly, that’s pretty hard to get that to work if I remember correctly. 
> It’s not very cheetah template friendly. I haven’t looked at this in a 
> while, but let me take a look at it this weekend.
>
> On Thursday, May 30, 2019 at 1:20:15 AM UTC-7, Hartmut Schweidler wrote:
>>
>> Hallo,
>>
>> I'm looking for an example in aqi.html.tmpl
>>
>> like "AQIs have categorical labels associated with the AQI values. The 
>> index of the current category is available via 
>> $latest('aqi_binding').aqi_pm2_5_category. From this, the label and 
>> color category can be found via (hex_color, category_label) = 
>> service.aqi_standard.interpret_aqi_index(index)"
>>
>> ich suche nach einem Beispiel für die Verwendung der Farben in einer 
>> AQI-Seite
>>
>> Hartmut
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/5b6932ab-dff2-406e-ba21-f4c20a9476aa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to