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.

158 lines
4.5 KiB

---
title: 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
categories: [amateur-radio]
tags: ["wx","linux"]
---
## 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.
~~~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 <kbd>Ctrl</kbd>+<kbd>C</kbd>).
~~~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 <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:
~~~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: <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](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.
<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" >}}