---
title: My weather station with WeeWX and Netatmo
aliases: /posts/2022-01-08-my-weather-station-with-weewx-and-netatmo
summary: >
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/).
date: 2022-01-08T14:34:54+01:00
lastmod: "2023-07-16T18:34:02+0200"
categories: [amateur-radio]
tags: [ "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][1] for development apps and do
not allow simple password authentications any more.
[1]: https://dev.netatmo.com/apidocumentation/oauth#authorization-code
{{< /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 "posts/2023/41-moving-weewx-to-openbsd" >}})
- [Update WeeWX extension]({{< ref "posts/2023/47-update-weewx-netatmo-extension" >}})
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
. You may also need an account on
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.
~~~console
# yum install epel-release
# yum install python3-cheetah
~~~
Continue with adding the repository of WeeWX to your system and install WeeWX.
~~~console
# rpm --import https://weewx.com/keys.html
# curl -s https://weewx.com/yum/weewx-el8.repo | tee /etc/yum.repos.d/weewx.repo
~~~
~~~console
# dnf install weewx
~~~
Look out for `/var/log/messages` in order to see if WeeWX is already running
(Abort with Ctrl+C).
~~~console
# tail -f /var/log/messages
~~~
## Configuration of WeeWX
Stop WeeWX and remove the database for now.
~~~console
# /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](https://github.com/matthewwall/weewx-netatmo) -- 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](https://github.com/bricebou/weewx-netatmo), who made a fork of the
original to be compatible with Python 3 (I think that is required now by WeeWX 4.x).
~~~console
# 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.
~~~console
# /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`.
~~~python
# file: "/usr/share/weewx/user/extensions.py"
#
# Copyright (c) 2009-2015 Tom Keffer
#
# 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:
~~~toml
# 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: .
I don't remember correctly, but I don't think you'll need that to just transport
your weather data into .
## 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](https://weewx.com/docs/usersguide.htm) -- 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.
→
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:
~~~py {linenos=table,hl_lines="5-6",linenostart=1281}
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**](https://neoground.com/projects/neowx-material)
and I like it very much. Another nice skin would be
[Rabenwetter](https://rabenwetter.de/info.html) that you might have a look on too.
But back to business :grin:
The installation is very easy:
- download
- install
~~~console
# wee_extension --install=neowx-material.zip
~~~
- restart
~~~console
# systemctl restart weewx
~~~
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](https://github.com/neoground/neowx-material#installation) 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.
~~~console
# 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](https://weather.gladstonefamily.net/site/AV859) 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).