bellrichm / weewx-aqi-xtype

A WeeWX XType to calclulate AQI.
GNU Affero General Public License v3.0
1 stars 0 forks source link

Document How to Add this to Standard Skins #1

Closed dshanske closed 9 months ago

dshanske commented 1 year ago

I tried to just add this to the Standard skin, which uses configuration variables, and that did not work.

bellrichm commented 1 year ago

I'm not familiar with configuration variables in the Standard skin. Can you point me to a description on how to use them?

dshanske commented 1 year ago

Excuse me, the Seasons skin.

dshanske commented 1 year ago

https://github.com/weewx/weewx/blob/master/skins/Seasons/skin.conf

It uses a variable list.

bellrichm commented 1 year ago

No prob, same question. Do you add the observation to some list somewhere?

dshanske commented 1 year ago

No prob, same question. Do you add the observation to some list somewhere?

Yes, in skin.conf there is a current observations, then I used your suggested code for the graphs...not working... but the built-in types do.

bellrichm commented 1 year ago

Thanks, I'll have to do some learning about the Seasons skin and get back to you.

dshanske commented 1 year ago

Thanks, I'll have to do some learning about the Seasons skin and get back to you.

Thanks....all of my weewx instances use your code already...

The irony is I added the AQI formula to esphome to send to Weewx over mqtt because I didn't feel like learning python, so this is perfect timing.

bellrichm commented 1 year ago

At the moment I'm a bit stumped. I've reached out to the WeeWX experts, https://groups.google.com/g/weewx-development/c/p8kgtU2Nb-U/m/odR_RbDAAgAJ?utm_medium=email&utm_source=footer

dshanske commented 1 year ago

At the moment I'm a bit stumped. I've reached out to the WeeWX experts, https://groups.google.com/g/weewx-development/c/p8kgtU2Nb-U/m/odR_RbDAAgAJ?utm_medium=email&utm_source=footer

I'll watch, but it works for the built in xtypes.

Either way...your implementation design is exactly what I was looking for.

bellrichm commented 1 year ago

Oh, good to hear that. I thought I was seeing that too. My current theory is that the built in XTypes have columns in the database...

bellrichm commented 1 year ago

I just released 1.0.2. With this update I was able to graph the aqi. Here is my seasons config in weewx.conf.

    [[SeasonsReport]]
        # The SeasonsReport uses the 'Seasons' skin, which contains the
        # images, templates and plots for the report.
        skin = Seasons
        #enable = false
        HTML_ROOT = private_html/seasons

        [[[DisplayOptions]]]
            plot_groups = barometer, tempdew, tempfeel, hum, wind, winddir, windvec, rain, ET, UV, radiation, lightning, tempin, humin, tempext, humext, tempext2, humext2, templeaf, wetleaf, tempsoil, moistsoil, pm, aqi

        [[[ImageGenerator]]]
            [[[[day_images]]]]
                [[[[[dayaqi]]]]]
                    [[[[[[pm2_5_aqi]]]]]]

Unfortunately it is looking like WeeWX will need an update to display it in the current section.

dshanske commented 1 year ago

What's the likelihood of getting that? Is there another function that would confirm data is being received?

bellrichm commented 1 year ago

I would think it is very likely that it will get fixed somehow. I did open, https://github.com/weewx/weewx/issues/877.

As a work around you could add it to the db. Base on my investigation I think this should work. But this defeats the purpose of calculating it dynamically.

I do have an example/test skin. The install does not update weewx.conf with it. I wasn’t sure if it really makes sense to… I could update the install or help you manually update weewx.conf. This would display it as a test.

You could display the day (or any/all) chart of them in Seasons skin.

dshanske commented 1 year ago

I came up with a temporary solution.

elif $x == 'pm2_5_aqi'

  <tr>
    <td class="label">$obs.label.pm2_5_aqi</td>
    <td class="data">$current.pm2_5_aqi</td>
  </tr>

end if

if getattr($recent, $obs).has_data or $plot_group == 'aqi'

    #set $show_plot = 1

Not elegant...I just forced it for now to always show it even if there is no data.

bellrichm commented 1 year ago

That makes sense. If you wanted to essentially check if pm2_5_aqi has data you could do something like this

#elif $x == 'pm2_5_aqi' and $year.pm2_5.has_data
   
    $obs.label.pm2_5_aqi
   
    $current.pm2_5_aqi

#end if

Assuming that pm2_5 is the input to calculating pm2_5_aqi.

dshanske commented 9 months ago

I believe that the fix linked may work now.

bellrichm commented 9 months ago

Agreed that V5 should have the necessary fix.