Best practices for an extension with new data

35 views
Skip to first unread message

Gerard Cerchio

unread,
Aug 19, 2022, 8:02:56 PM8/19/22
to weewx-development
Greetings dev group,

I recently started using weewx for for my newly resurrected Davis Vue Station. Being that I live across the street from the Pacific ocean, I wanted to add current marine data to my website. I have succeeded in an extremely hacky sort of way using a cron python job to read the nearby NOAA buoy RSS feed and extract the summary html into a file that   my template file includes into the generated html.

My next goal it to get the data items, wave height, both wave periods, wave direction and water temperature into the weewx archive so that I can provide history plots and run another row of gauges on my site.

Reading the documentation I have discovered multiple ways of storing weewx data that evolved over time:
  1. an independent data base (this looks difficult to integrate)
  2. adding columns to the existing weewx table (is this shareable extension friendly?)
  3. using the config file to rename some of the existing unused weewx columns.
  4. another method I missed?
I would like some guidance as to which is the most favored path to create an NOAA buoy extension that I may share with the community.

Vince Skahan

unread,
Aug 19, 2022, 9:29:51 PM8/19/22
to weewx-development
An independent db is quite easy to integrate if weewx doesn't already have built-in ones that match up with what you're doing.  There are a zillion good examples of how to set up the db (the python code) and how to reference it (the cheetah .tmpl templates).  Very straightforward.

Doug Jenkins

unread,
Aug 19, 2022, 10:23:34 PM8/19/22
to weewx-development
Ocean Beach:

I was taking notes on your recent work with the NOAA buoy RSS as I have several of these buoys near me as I live very close to the Gulf of Mexico here in the Tampa Bay area.

As Vince stated earlier, it is actually simple to write to a separate db in weewx. what you want to do is write an extension that uses the archive method that will pull the RSS, compare it to see if there are any deltas, and commit it using WeeWx DB Manager to its own database. here are some key links in the weewx documentation that can give you an understanding of the process:

Adding_2nd_source : http://weewx.com/docs/customizing.htm#Adding_2nd_source
Customizing the database : http://weewx.com/docs/customizing.htm#archive_database
creating a driver : http://weewx.com/docs/customizing.htm#Implement_the_driver

Once you get your data service driver working, you want to package it. here is the link to understand the extension packing process

http://weewx.com/docs/customizing.htm#extensions


Finally, I would spend some time studying this weewx extension called weewx-nws.
This was written by John Kline and he is essentially interfacing with the NWS API and writing the data into a separate database. This approach is similar to what you are trying to achieve.

https://github.com/chaunceygardiner/weewx-nws

remember, once you have this in a database, you can add it as another archive source and reference it in your skin with graphs. Here is the documentation that discusses that

http://weewx.com/docs/customizing.htm#Using_multiple_bindings

I hope this helps you along the way.

Doug Jenkins
largoweather.com
Reply all
Reply to author
Forward
0 new messages