You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8.9 KiB

title summary date lastmod categories tags
My weather station with WeeWX and Netatmo Describing my approach to properly install WeeWX on a virtual server which creates the [weather page](https://wx.oe7drt.com/) and also uploads my weather data to the [APRS-IS network](http://www.aprs-is.net/). 2022-01-08T14:34:54+01:00 2023-07-16T18:34:02+0200
amateur-radio
wx
weewx
netatmo
linux
server
selfhost

Update on 16th July 2023

{{< alert >}} Okay, just for your information. I no longer use Redhat on my servers and the following mentioned weewx-extension does no longer work, because Netatmo has changed their authentication policy for development apps and do not allow simple password authentications any more.

{{< /alert >}}

That means we have to update the extension to a fork that is recently updated.

There are two Follow-up posts to this article that show the migration to an OpenBSD server as well as the replacement of the netatmo weewx-extension.

  • [Moving WeeWX to OpenBSD]({{< ref "2023-05-27-moving-weewx-to-openbsd/index.md" >}})
  • [Update WeeWX extension]({{< ref "2023-07-15-update-weewx-netatmo-extension/index.md" >}})

I recommend reading the last one to get a working setup. If you want to have a nice status message on APRS I also recommend reading the first one too, because it includes a little script to accomplish that with python.

Preparation

{{< alert >}} As I'm using a redhat based distribution I installed WeeWX with some help of https://weewx.com/docs/redhat.htm. You may also need an account on https://dev.netatmo.com/ for this to work. There you get your client ID and client secret tokens that you will later need to reconfigure WeeWX to make use of the netatmo driver extension.
Also note, that most commands (if not all) here have to be run as the root user. {{< /alert >}}

First of all, install epel-release so you can install python3-cheetah finally.

# yum install epel-release
# yum install python3-cheetah

Continue with adding the repository of WeeWX to your system and install WeeWX.

# rpm --import https://weewx.com/keys.html
# curl -s https://weewx.com/yum/weewx-el8.repo | tee /etc/yum.repos.d/weewx.repo
# dnf install weewx

Look out for /var/log/messages in order to see if WeeWX is already running (Abort with Ctrl+C).

# tail -f /var/log/messages

Configuration of WeeWX

Stop WeeWX and remove the database for now.

# /etc/init.d/weewx stop
# rm /var/lib/weewx/weewx.sdb

Installation of netatmo driver

There are more extensions for Netatmo out there, the original extension is the one from matthewwall -- but this won't work with WeeWX 4.x and up.
So I had to find another one, which I did. It's from bricebou, who made a fork of the original to be compatible with Python 3 (I think that is required now by WeeWX 4.x).

# wget -O weewx-netatmo.zip https://github.com/bricebou/weewx-netatmo/archive/master.zip
# wee_extension --install weewx-netatmo.zip
# wee_config --reconfigure

Have a look at the file /etc/weewx/weewx.conf because it sometimes happens, that the configuration is not properly written.

Starting WeeWX again

You can also use systemctl start weewx instead.

# /etc/init.d/weewx start

Localisation

The setup is done, although if you like your pages with another locale you may want to alter the file /usr/share/weewx/user/extensions.py.

# file: "/usr/share/weewx/user/extensions.py"
#
#    Copyright (c) 2009-2015 Tom Keffer <tkeffer@gmail.com>
#
#    See the file LICENSE.txt for your full rights.
#

"""User extensions module

This module is imported from the main executable, so anything put here will be
executed before anything else happens. This makes it a good place to put user
extensions.
"""

import locale
# This will use the locale specified by the environment variable 'LANG'
# Other options are possible. See:
# http://docs.python.org/2/library/locale.html#locale.setlocale
locale.setlocale(locale.LC_ALL, 'de_AT.UTF-8')

Pushing weather data to APRS-IS

Make sure you get a similar entry in your /etc/weewx/weewx.conf file:

# file: "/etc/weewx/weewx.conf"
...

[StdRESTful]
  [[CWOP]]
    enable = true
    station = "n0call-13"
    passcode = "your_aprs-fi_passcode"
    post_interval = 300

...

Now, you could also join CWOP over here: http://www.findu.com/citizenweather/signup.html. I don't remember correctly, but I don't think you'll need that to just transport your weather data into https://apsr.fi/.

Going further

{{< alert >}} Advanced computer skills may be required for this. You may end up editing some python scripts to finally get what you want. But if you want to learn something new, your weather page may benefit from that. {{< /alert >}}

You may also want to inspect the installed skins (templates) which reside in /etc/weewx/skins -- adopt them to your needs and enable some more reports in [StdReport] like [[SeasonsReport]]. Adopt everything and make sure to read throughout the documentation -- that helped me a lot.

When I got my virtual server to host WeeWX I also ended up installing nginx on it and I finally configured it to present the weather pages (SeasonsReports) from WeeWX.

https://wx.oe7drt.com

The link is also on the bottom of every page aswell and the website looks something like this:

{{< figure src="wx-main.png" alt="website preview" >}}

Update on December 25, 2022

My station runs for a while now and I wasn't sure if I continue using Netatmo for my weather station, but since the stations works quite well I bought a rain and wind sensor the recent days. The first test run went good and it was easy to implement the new devices.

But there are a few notes to remember. As there are more than one point, I'll put them down into separate headings.

Change the comment visible on the aprs.fi website

If you want to change the comment that is visible on aprs.fi you have to change the source of a python file within the WeeWX package. As I upgraded WeeWX when I installed the new devices that file got overwritten and it took me (again) a few moments to find the right place again. Now, for the future: the file I talk about is /usr/share/weewx/weewx/restx.py and you may look somewhere near the line 1285. I show you an excerpt of my current (already modified) file:

1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 else: _radiation_str = "" # Station equipment #_equipment_str = ".weewx-%s-%s" % (weewx.__version__, self.station_type) _equipment_str = "https://wx.oe7drt.com/" _tnc_packet = ''.join([_prefix, _time_str, _latlon_str, _wt_str, _rain_str, _baro_str, _humid_str, _radiation_str, _equipment_str, "\r\n"]) # show the packet in the logs for debug if weewx.debug >= 2: log.debug("CWOP: packet: '%s'", _tnc_packet.rstrip('\r\n')) return _tnc_packet

Line 5 and 6 (highlighted) shows the old and new line. Should work fine.

Install a new (and more modern) theme

That actually looks like a modern website. Although, I had to re-create some entries for the sensor-images. As this sucks pain, I'll leave it with only having 1-day images. They are quite useless, but I may find another day. Or not, we will see...

The name of the skin is NeoWX Material and I like it very much. Another nice skin would be Rabenwetter that you might have a look on too.

But back to business 😁

The installation is very easy:

I usually don't give this hint: note the # at the beginning of these command lines. That means to run those commands as root.

Read the docs and you should be good to go.

I did already had the python3-ephem package installed, I used the Almanac pages already in the older (default) Seasons skin.

# dnf install python3-ephem

The new theme looks like this:

{{< figure src="wx-main_new.png" alt="preview of the new theme/skin" >}}

Some other thoughs

I never got the correct information working on the CWOP information page but I've seen this page showing the correct information now. Also the map is now filled with weather stations around my area (this has always been a place in the US that I wasn't able to change).