Skip to content

Adding a new observation type to the WeeWX database

Pat O'Brien edited this page Dec 27, 2018 · 7 revisions

The Belchertown skin has options to show observations that aren't included in a default installation of WeeWX. We need to extend the database to add some new columns for WeeWX to do its calculations and storage within.

For example, Apparent Temperature (appTemp) and Wind Run (windRun) are a couple currently in the skin that are not calculated with the default WeeWX install.

The WeeWX Customization Guide already can show you how to add new observations to your database, however the goal of this page is to keep it focused on the observations the skin can work with. Hopefully this becomes an easy copy-and-paste project for you.

Step 1

Have a backup of your database! Backing up your WeeWX database should be something you do routinely, but if not, now's the time. If something goes sideways with the below instructions, don't blame me if you don't have a backup 😃

Once you extend your database to add these columns the easiest way to back-out is to restore your database. There are some tools out there that can help you delete columns, but that's outside the scope of this tutorial.

Step 2

Stop WeeWX.

Edit your bin/user/extensions.py file and add the following lines. You do not need to add all of them unless you want to. If you haven't guessed it, ('appTemp', 'REAL') will add apparent temperature and ('windrun', 'REAL') will add wind run.

If you don't want to add all of these observations, just remove the parenthesis sections, but keep the square brackets.

import schemas.wview
schema_extended = schemas.wview.schema + [('appTemp', 'REAL'), ('windrun', 'REAL')]

Step 3

Take a backup copy of your weewx.conf and set it to the side.

Edit weewx.conf and update it to use our new database schema.

Under [DataBindings], look for [[dest_binding]], then look for schema = schemas.wview.schema. Replace this whole line with

schema = user.extensions.schema_extended

Step 4

Rebuild your database with new daily archive tables. Run sudo wee_database --rebuild-daily.

Step 5

Restart WeeWX. You're ready to enable the show_appTemp or show_windRun options in the Belchertown skin.


  • Note you can either keep the user.extensions.schema_extended section from Step 3 in weewx.conf or revert it back to schemas.wview.schema after the database has been extended following step 5. WeeWX's schema is obtained dynamically from the database upon restarts so basically if the database column exists, WeeWX will calculate it. I'd recommend leaving it alone though.