Packaging a new driver as an extension

106 views
Skip to first unread message

Billy Jackson

unread,
Jul 1, 2022, 12:54:04 PM7/1/22
to weewx-development
Howdy,

I wrote a new driver to utilize my WeatherFlow Tempest's REST API rather then the local UDP API.  The use case for me is running weewx in the cloud and not having to utilize a local network broadcast etc....

I have it running in a test instance at http://54.191.34.110/ and it mostly seems to be behaving right now so I'd like to package it up for wee_extension for installation if folks would like to give it a whirl but I can't seem to find a good reference on how to do this.  

I'm wondering if anyone can point me in the right direction?

One option is to copy the work that captain-coredump did on his weatherflowudp driver but I'd like to actually understand the options/syntax etc....

Many thanks!

Billy

Tom Keffer

unread,
Jul 1, 2022, 1:44:56 PM7/1/22
to Billy Jackson, weewx-development
Unfortunately, there is no step-by-step guide on how to package an extension. The best we have is a set of examples in the examples subdirectory.

A very worthy project (and learning experience) would be to write a wiki article about how to do it. 

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/4ef7675c-c331-4ab1-9b13-bc2dc64d1a9an%40googlegroups.com.

Billy Jackson

unread,
Jul 1, 2022, 3:06:19 PM7/1/22
to weewx-development
Got it,

I'll check out the examples section and see what I can learn there.

Billy

Vince Skahan

unread,
Jul 1, 2022, 9:44:26 PM7/1/22
to weewx-development
Take a look at just about any skin or driver at this point.   If you want to see a big one, look at the Belchertown skin which has some things in there to embed a lot of comments into the right section in weewx.conf as it installs, hopefully to make things a little easier to configure for folks since that one is so configurable.

Billy Jackson

unread,
Jul 2, 2022, 1:21:42 AM7/2/22
to weewx-development
Alrighty!

I figured out how to create config stanzas and file stanzas BUT I have a few questions.  Note that I tried reading through the source for wee_extension to see if I could sort this out myself but I'm a bit baffled still.
  • Is there a way to replace a config value via the stanza without writing custom code?  I.e. I see some fairly complex custom code to break out and do custom things in some of the more complicated drivers/skins but I'm trying to avoid that if I can.  I specifically want to replace the station_type stanza to reflect the driver I just installed.
  • Is there a way to "place" the config_dict values.  By default they are going to the end of the file which is OK but also forces the user to dig to enter some of the values like the API token and device ID.  Alternately I suppose these could be prompted for if I write some custom code?

Many thanks

Billy

Vince Skahan

unread,
Jul 2, 2022, 11:56:50 AM7/2/22
to weewx-development
You might want to require the user run wee_config themselves to pick which station type they want to activate.  Sometimes folks install the driver and then configure a lot of things manually 'before' activating it.  My hazy recollection is some drivers (Gary's ecowitt one perhaps) might even ask questions as well when you activate them with wee_config.

Billy Jackson

unread,
Jul 2, 2022, 3:01:04 PM7/2/22
to weewx-development
Thanks Vince, I'll go look up ecowitt .  Also, I was banging my head against the wall about why the Belchertown install file puts a stanza replacing all of stdReport in the right place and found the code where it "reshuffles" skin stanzas to make sure they come before ftp/rsync.  

I'm wondering if I can access the entire configobject from the install.py but likely I don't actually want to :^). Seems a bit intense.

In other news the Websocket driver is working nicely and comparing it to the restAPI driver does a good job of capturing a LOT more wind data.  Biggest thing I lose from not using the UDP data is rssi strength for the hub/tempeest but I finally have that nailed down pretty good in my installation so I'm not too worried there.

Thanks for all the help.  Once I work through this, get a readme into the module I'll post it for folks to try out/test.  I'll also consider trying to figure out how to do a pull request for the wiki and at least covering the basics of a driver install.

Billy

Billy Jackson

unread,
Jul 2, 2022, 7:12:48 PM7/2/22
to weewx-development
I think I got it sorted most of the way.  There's still an opportunity to figure out where to place the stanza on first install, and I can see it being done by wee_config when it changes drivers but am not quite sure how to pull that off in the install.py.  It could also likely go into wee_extension source to detect if it's a driver but I'm not quite good enough with python to pull that off.  

If anyone would like to peer review/look at the installation instructions or source feel free.  https://github.com/livysdad27/tempestWS is where it's at.

Billy

Billy Jackson

unread,
Jul 3, 2022, 1:20:43 AM7/3/22
to weewx-development
Last but not least, here's a driver tips wiki page that covers the basics of driver packaging etc... https://github.com/weewx/weewx/wiki/Weewx-Driver-Development-Tips .  I'd welcome any feedback here as there's still a few things I don't fully understand like why the file structure of bin/user seems to drop the file in /usr/share/weewx/user on my Ubuntu VMs.  I also still suspect there's an opportunity to place the driver stanza in the "right" location under the Station stanza but after reading the wee_config source I think it likely belongs there kind of like the report cleanup stuff does.  That or else it could go into wee_extension after checking to see that this is indeed a driver.

Feedback welcome of course.

Billy

Vince Skahan

unread,
Jul 3, 2022, 1:12:31 PM7/3/22
to weewx-development
The location of the user 'bin' directory differs depending on whether you used a packaged installation (as you did) or if you did a setup.py installation of weewx.


Reply all
Reply to author
Forward
0 new messages