Author Topic: Davis Airlink on Weewx  (Read 2013 times)

0 Members and 1 Guest are viewing this topic.

Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Davis Airlink on Weewx
« on: June 10, 2022, 06:09:51 AM »
I installed my Airlink on Weewx following the instructions at https://github.com/chaunceygardiner/weewx-airlink

The "test page" appears on my server. If I then follow the instructions further, I get lost.

Where, how and in which template should I include the second part of the instruction?
For example: "....To show the PM2.5 reading, use the following:
$current.pm2_5....."
I've tried everything, but either the site crashes or nothing happens.

By the way, I don't know if I will receive data (nothing on the server at this moment..) because maybe it has to be done in the way as stated in "Note" where it is stated that it also works via the proxy.
 ",,Note: The port can be specified because this extension also works with the airlink-proxy service. That service typcially uses port 8000...."

And I'm also not sure if I mentioned the right thing in the weewx.conf at Engines.
It now includes:
[AirLink]
     [[192.xxx.xx.107]]
         enable = true
         hostname = Airlink front yard
         postage = 80
         timeout = 2
     [[Sensor2]]
         enable = False
         hostname = airlink2
         postage = 80
         timeout = 2


But I thought I'd start by understanding where I should put that $current etc.
Then I might also better understand the relationship in and with all the different templates.

It will be apparent that I am just getting started and am a complete newbie to Weewx.

Can someone help me on my way?
Sorry if it's really stupid what I'm asking....

thanks,

Bart

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #1 on: June 26, 2022, 12:57:17 PM »
2 weeks and no answer :-(.
I'm a noob myself, so know the problems.
I can't help you with the airlink, but the following might help you with the tag.

Or you might have found the answer yourself by now.

You don't say which skin you are using, but Seasons is most likely.

The end of my current.inc  (/etc/weewx/skins/Seasons/current.inc)
looks like this

#if $day.soilMoist5.has_data
      <tr>
        <td class="label">$obs.label.soilMoist5</td>
        <td class="data">$current.soilMoist5</td>
      </tr>
#end if
#if $day.pm2_5.has_data
      <tr>
        <td class="label">$obs.label.pm2_5</td>
        <td class="data">$current.pm2_5</td>
      </tr>
#end if
    </tbody>
  </table>
  </div>

</div>

and gives me this.

 [ You are not allowed to view attachments ]

If you have added the Belchertown skin, and are looking for something like this_
 [ You are not allowed to view attachments ]
Then you need to modify /etc/weewx/skins/Belchertown/index_hook_after_station_info.inc

I've attached a txt copy of mine, but be aware it's modified for UK values and colours.

 [ You are not allowed to view attachments ]



Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #2 on: June 26, 2022, 02:29:22 PM »
Indeed, after many attempts I succeeded.
I am happy with your response. What you've attached is exactly what I need to better understand the connections between those templates, configuration files, and so on. It is explained in detail, but I don't fully understand it yet.
But perseverance and help win.

Thank you!

Bart

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #3 on: June 26, 2022, 02:49:42 PM »
I started with my first pi in Feb.
The learning curve is tough.
Google and perseverance win.

Good luck on your journey.

Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #4 on: July 10, 2022, 05:21:23 AM »

If you have added the Belchertown skin, and are looking for something like this_
 [ You are not allowed to view attachments ]
Then you need to modify /etc/weewx/skins/Belchertown/index_hook_after_station_info.inc

I've attached a txt copy of mine, but be aware it's modified for UK values and colours.


Now it seems like I got it done. I copied your input into my skin index template (I use skin seasons 4.8.0). The result is that it works. A bit too many digits after the decimal point. Does anyone know how to get that rounded (1, 2 digits)?
By the way, I cheated the Airlinkt with some smoke. The AQ is good, but there is no movement. Just to see if there was any movement in the display in the skin.

Bart

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #5 on: July 11, 2022, 01:35:00 PM »
Well done.
Mine usually behaves, but occasionally I have a similar issue.
So you have spurred me into finding a solution.

I am part way there!!!
Basic problem lies within each of the following.

#if $current.pm2_5.raw <= 11
    <td class="stats_data" style="background-color: #9cff9c;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.raw, AQI is 1 Low</td>

I have changed each statement to

#if $current.pm2_5.raw <= 11
    <td class="stats_data" style="background-color: #9cff9c;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5, AQI is 1 Low</td>

I also needed to add a format to weewx.conf
under
            # The following section sets the formatting for each type of unit.
            [[[[StringFormats]]]]

I have added
                µg/m³ = %.0f 


I now get

 [ You are not allowed to view attachments ]

I'm working on the 24h avg. edit (now fixed)

« Last Edit: July 11, 2022, 02:37:09 PM by DelChard »

Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #6 on: July 13, 2022, 04:23:36 AM »
Great... =D&gt;
Sorry but I won't be able to try it out until this weekend or even next week.

Bart

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #7 on: July 13, 2022, 07:46:44 AM »
Alternative method which gives me 1 decimal place precision.

#if $current.pm2_5.raw <= 11
    <td class="stats_data" style="background-color: #9cff9c;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 1 Low</td>
  #else if $current.pm2_5.raw >= 12 and $current.pm2_5.raw <= 23
    <td class="stats_data" style="background-color: #31ff00;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 2 Low</td>
  #else if $current.pm2_5.raw >= 24 and $current.pm2_5.raw <= 35
    <td class="stats_data" style="background-color: #31cf00;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 3 Low</td>
  #else if $current.pm2_5.raw >= 36 and $current.pm2_5.raw <= 41
    <td class="stats_data" style="background-color: #ffff00;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 4 Moderate</td>
  #else if $current.pm2_5.raw >= 42 and $current.pm2_5.raw <= 47
    <td class="stats_data" style="background-color: #ffcf00;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 5 Moderate</td>
  #else if $current.pm2_5.raw >= 48 and $current.pm2_5.raw <= 53
    <td class="stats_data" style="background-color: #ff9a00;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 6 Moderate</td>
  #else if $current.pm2_5.raw >= 54 and $current.pm2_5.raw <= 58
    <td class="stats_data" style="background-color: #ff9292;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 7 High</td>
  #else if $current.pm2_5.raw >= 59 and $current.pm2_5.raw <= 64
    <td class="stats_data" style="background-color: #ff0000;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 8 High</td>
  #else if $current.pm2_5.raw >= 65 and $current.pm2_5.raw <= 70
    <td class="stats_data" style="background-color: #990000;text-align:center;color: black"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 9 High</td>
  #else if $current.pm2_5.raw >= 71
    <td class="stats_data" style="background-color: #ce30ff;text-align:center;color:yellow"><H4>Current PM2.5 is $current.pm2_5.format(format_string="%.1f"), AQI is 10 Very High</td>
#end if

Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #8 on: July 15, 2022, 01:05:14 AM »
You're good, I still have a lot to learn from what it looks like....I neither wouldn't have known nor figured this out. But that's how you learn on the job...I guess.

I wanted to try it out..and yess it works. When I have normal time again I want to try to display the AQ index in this way.
(Note: the AirLink will be disconnected from the power for a few hours due to maintenance)

Thanks,

Bart

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #9 on: July 15, 2022, 10:58:34 AM »
I ain't good, just got time to look  :lol:

Found the original here https://groups.google.com/g/weewx-user/c/Pq9ZwFkyDvs/m/zSykcBXOBgAJ
Then modified it to suit the generous UK values, you might want to find the correct values for your location.

The search at the top is a good place to start for anything unusual.

The final (simple) trick, was from here, https://weewx.com/docs/customizing.htm (Formatting options with expected results),I should have checked there first.

Glad it works for you.

Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #10 on: July 18, 2022, 04:22:10 AM »
Out of curiosity, what exactly are the UK values? Which index did you use? I think I'll adjust the list to the EPA index, which is the most common, I believe.
I also have a page ( https://bdepoel.com/weewx/airlink/ ) where the index is displayed: But I don't see where it's taken from in the database...
This also applies to the daily average. Now I only see the current value.

But that I don't see it could also be because today my brain doesn't seem to work :roll: #-o :shock: So I'll stop before I mess things up.

Bart

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #11 on: July 18, 2022, 08:17:45 AM »
I used the levels and colours from this page https://uk-air.defra.gov.uk/air-pollution/daqi?view=more-info&pollutant=pm25#pollutant

From memory (hazy at my age), I had to add a column to the database for 24H  average.
The ecowitt system churns it out, but it wasn't being stored anywhere.

As for your AQI, I'm confused.
You have a chart, so, presumably you created it in the Seasons skin.conf.
It's not there by default.

Just looked at github page, whilst the charts look like Seasons charts, I see they are generated by weewx-airlink.
Further, from the github page the values you are looking for are NOT stored in the database, but calculated by the extension.
Also the extension uses US values.

    def compute_pm2_5_aqi(pm2_5):
        #             U.S. EPA PM2.5 AQI
        #
        #  AQI Category  AQI Value  24-hr PM2.5
        # Good             0 -  50    0.0 -  12.0
        # Moderate        51 - 100   12.1 -  35.4
        # USG            101 - 150   35.5 -  55.4
        # Unhealthy      151 - 200   55.5 - 150.4
        # Very Unhealthy 201 - 300  150.5 - 250.4
        # Hazardous      301 - 400  250.5 - 350.4
        # Hazardous      401 - 500  350.5 - 500.4

I found a similar issue with another AQI extension, which I ended up ditching, and using the values from my weewx.sdb

I ended up plotting the PM2.5 values in front of the UK AQI bands.
 [ You are not allowed to view attachments ]

« Last Edit: July 18, 2022, 10:25:01 AM by DelChard »

Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #12 on: July 19, 2022, 03:24:31 AM »
Ok I see that your confusion has disappeared but now it has arisen with me. I suspect that because we use different hardware, there will be a difference in outcome.

In addition to the standard installation of Weewx, I have installed an extra driver for a correct reporting of my AirLink. This resulted in an extra sub directory in SKINS, airlink.

In /weewx/skins/airlink are two files:
Index.html.tmpl and skin.conf

In index.html.tmpl there is this line:
#if $current.pm2_5_aqi.has_data

So apparently there is data in the database because in a test file (index.html, see the link I added earlier) it currently says:

WeeWX-AirLink Report
Air Quality Index: 30 AQI

The Weewx home page at this moment includes:

Current PM2.5 is 7,7 µg/m³, AQI is Good

Created mainly through your efforts. I have adapted it to the EPA standard that I use myself. https://www.airnow.gov/aqi/aqi-basics/

I don't really understand the difference in outcome. The AQ index says 30 and the measurement of the 2.5 particles 7.7
The first is an index and the second is a single (current) measurement. But now we list the measurement as an index. The choice of reporting on COMEAP or EPA does not matter.

And I would like to get that index message reported on my Weewx home page the same way as the current value. Maybe instead of....

I already said "..you're good... [tup]" I still have a lot to learn. Now I also have to follow a database course..... #-o :shock:

But anyway we have fun with and without hazy (or not working, in my case) brains

Bart
« Last Edit: July 19, 2022, 03:30:30 AM by DGP »

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #13 on: July 19, 2022, 04:43:07 AM »
Hi

Extract from your added extension readme.

In addition to pm1_0, pm2_5 and pm10_0, AQI variables are also available (even though they are not in the database) via WeeWX 4's XTypes. pm2_5_aqi is automatically computed from pm2_5 and can be used in reports ($current.pm2_5_aqi, $day.pm2_5_aqi) and in graphs ([[[[pm2_5_aqi]]]). Also available is is the RGBint value $current.pm2_5_aqi_color (useful for displaying AQI in the appropriate color (e.g., green for AQIs <= 50).

The red text tag is the one you would need in your webpage.

But this will be US AQI.

Our differing hardware is an issue. It's a shame that no Davis users have chipped in.

I have an advantage with Ecowitt, in that the sensor is fuly integrated, i.e. shows in the console/gateway.





Offline DGP

  • Member
  • *
  • Posts: 31
    • The Weather over here
Re: Davis Airlink on Weewx
« Reply #14 on: July 21, 2022, 01:33:47 AM »
I'm a little further. I now have this on my Weewx page (https://bdepoel.com/weewx/).

Changing the color with $current.pm2_5_aqi_color doesn't work for me yet (it works on the previously attached link) but I changed that your way...perhaps better.

I did adjust the measurements at the current AQ index after reading this.
https://www.airnow.gov/sites/default/files/2020-05/aqi-technical-assistance-document-sept2018.pdf

See page 4, table 4.
I assume that such a document can also be found for the UK index.
So for example: PM2.5 12.1-35.4 is moderate and equal to the AQ index 51-100.
Please note that these are EPA values but it is about insight.

Now I'm looking for a different way of presenting one that fits well with my now used Weewx skin.

It is indeed a pity that there is no input from other Ecowitt or Davis users. But we're going well.. going strong.

Bart
« Last Edit: July 21, 2022, 03:55:32 AM by DGP »

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #15 on: July 21, 2022, 05:02:28 AM »
 [tup] Looking good.
As far as I am aware there is not a UK equivalent to the US doc you referenced.

All references like the one below point to the DEFRA levels.

The UK’s network of governmental sensors typically monitors a range of up to six main pollutants. These include fine particulate matter (PM2.5), coarse particulate matter (PM10), nitrogen dioxide (NO2), sulphur dioxide (SO2), carbon monoxide (CO) and ozone (O3). DEFRA reports air quality levels combining these different pollutants using a specific UK air quality index, called the ‘Daily Air Quality Index’ (DAQI). The DAQI bands air quality levels along a scale of 1-10, which corresponds to different health hazard warning related to air pollution levels, where 1-3 is ‘Low’, 4-6 is ‘Moderate’, 7-9 is ‘High’, and 10 is ‘Very high’.14

Offline mcrossley

  • Forecaster
  • *****
  • Posts: 1128
    • Wilmslow Astro
Re: Davis Airlink on Weewx
« Reply #16 on: July 21, 2022, 08:53:52 AM »
One of the best UK docs I found is this one.

Again it emphasises that the index is a 24 hour average, it should not really be applied to shorter intervals or current values.
Mark

Offline DelChard

  • Senior Contributor
  • ****
  • Posts: 205
Re: Davis Airlink on Weewx
« Reply #17 on: July 21, 2022, 10:49:27 AM »

Again it emphasises that the index is a 24 hour average, it should not really be applied to shorter intervals or current values.

 [tup] I agree, however I don't publish, so my charts and pages are for purely personal use.
I originally set up with just low, med, high colours. But intrigued by a post from Broadstairs, I checked the DEFRA site and changed to their values and colours, the values for PM10 24Hr mean are currently lower than those given in Annex 1 of the 2011 Comeap report.
That was a pleasant surprise.
The bit I did find interesting from that report is in Annex 12.
It appears that only the USA were including PM2.5 in their AQI at that time.