Difference between revisions of "WeeWX"

From The TinkerNet Wiki
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This particular set of instructions is based on building a standalone VM to handle WeeWX.  On my network, I have an existing WebServer & an existing Automation Server.  The intent is to have the weather information served up as a web page (Default WeeWX thing...) by the WebServer and also be used by the Automation Server.
 
This particular set of instructions is based on building a standalone VM to handle WeeWX.  On my network, I have an existing WebServer & an existing Automation Server.  The intent is to have the weather information served up as a web page (Default WeeWX thing...) by the WebServer and also be used by the Automation Server.
  
There is also a dedicated Database Server which will eventually be used.
+
There is also a dedicated Database Server which we will be using. (can't possibly do things the easy way...)
  
 
(Based on: [http://www.weewx.com/docs/debian.htm WeeWX: Installation on Debian-based systems])
 
(Based on: [http://www.weewx.com/docs/debian.htm WeeWX: Installation on Debian-based systems])
Line 21: Line 21:
  
 
==Configuration==
 
==Configuration==
Coming<sup>TM</sup> Soon<sup>TM</sup>
 
  
Setting up the database (using MySQL)
+
===Setting up for YOUR Weather Station===
 +
Coming<sup>TM</sup> Soon<sup>TM</sup> Maybe<sup>TM</sup>
 +
 
 +
(Just as an example...  We have an AcuRite 01024 weather station here.  It works well, but it still sucks in a large number of ways...)
 +
 
 +
===Setting up the database (using MySQL)===
 +
(based on: [http://www.weewx.com/docs/usersguide.htm#configuring_mysql Configuring MySQL / MariaDB])
 +
 
 +
On the Database Server:
 +
 
 +
(NOTE: Your Database Server must be configured to allow remote access.)
 +
 
 +
*<code>sudo mysql -u root -p</code>
 +
 
 +
CREATE USER 'weewx'@'Machine.Domain.TLD' IDENTIFIED BY 'weewx';
 +
CREATE DATABASE weewx;
 +
GRANT select, update, create, delete, insert, drop ON weewx.* TO weewx@'Machine.Domain.TLD';
 +
 
 +
===Tell WeeWX to use the MySQL database===
 +
 
 +
*<code>sudo vim /etc/weewx/weewx.conf</code>
 +
 
 +
in <nowiki>[[wx_binding]]</nowiki>
 +
 
 +
change
 +
 
 +
<code>database = archive_sqlite</code>
 +
 
 +
to
 +
 
 +
<code>database = archive_mysql</code>
 +
 
 +
in <nowiki>[[MySQL]]</nowiki>
 +
 
 +
change
 +
 
 +
<code>host = localhost</code>
 +
 
 +
to
 +
 
 +
<code>host = Machine.Domain.TLD</code>
 +
 
 +
('''Machine.Domain.TLD''', of course, being the address of your Database Server...)
  
<br />
 
 
==Webserver Updating==
 
==Webserver Updating==
Coming<sup>TM</sup> Soon<sup>TM</sup>
+
(Based on: [http://www.weewx.com/docs/usersguide.htm#If_the_server_is_on_a_different_machine If the server is on a different machine])
 +
 
 +
Using FTP to upload/update the WeeWX generated webpages.
 +
 
 +
(Your Web Server will need to have FTP enabled...)
 +
 
 +
*<code>sudo vim /etc/weewx/weewx.conf</code>
 +
 
 +
<nowiki>[StdReport]</nowiki>
 +
    <nowiki>[[FTP]]</nowiki>
 +
        skin = Ftp
 +
        server = Machine.Domain.TLD
 +
        path = /var/www/html/weewx
 +
        user = USERNAME
 +
        password = PASSWORD
  
 
==MQTT==
 
==MQTT==
Coming<sup>TM</sup> Soon<sup>TM</sup>
+
As a start...  pip doesn't seem to be a default thing...  Kinda silly that...
 +
 
 +
*<code>sudo apt-get install python3-pip</code>
 +
 
 +
Then, we'll work from [https://github.com/weewx/weewx/wiki/mqtt iain MacDonnell's instructions on GitHub]
 +
 
 +
Download the WeeWX MQTT Extension:
 +
 
 +
*<code>wget -O weewx-mqtt.zip <nowiki>https://github.com/matthewwall/weewx-mqtt/archive/master.zip</nowiki></code>
 +
 
 +
Install paho-mqtt
 +
 
 +
*<code>sudo pip3 install paho-mqtt</code>
 +
 
 +
Install the extension
 +
 
 +
*<code>sudo wee_extension --install weewx-mqtt.zip</code>
 +
 
 +
restart WeeWx
 +
 
 +
*<code>sudo /etc/init.d/weewx restart</code>
 +
 
 +
Then edit weewx.conf to configure things for your own MQTT server
 +
 
 +
*<code>sudo vim /etc/weewx/weewx.conf</code>
 +
 
 +
    <nowiki>[[MQTT]]</nowiki>
 +
        server_url = mqtt://Machine.Domain.TLD:1883
 +
        topic = weather
 +
        unit_system = METRIC
  
 
==Administration==
 
==Administration==
 
Checking status:
 
Checking status:
  
*<code>sudo tail -f /var/log/syslog | weewx</code>
+
*<code>sudo tail -f /var/log/syslog | grep weewx</code>
  
 
Starting:
 
Starting:
Line 80: Line 163:
 
**[https://github.com/weewx/weewx/wiki/usb-issues USB hardware issues]
 
**[https://github.com/weewx/weewx/wiki/usb-issues USB hardware issues]
 
**Bloody cheapass USB extensions...  :P
 
**Bloody cheapass USB extensions...  :P
 +
**Check the USB Mode setting on the indoor unit.  Make sure it hasn't lost its little mind.
 +
**This needs to be set to '''Mode 3'''.
 
*weewx[951]: acurite: Cannot find USB device with VendorID=0x24c0 ProductID=0x0003 DeviceID=None
 
*weewx[951]: acurite: Cannot find USB device with VendorID=0x24c0 ProductID=0x0003 DeviceID=None
 
**Unit is completely unplugged...
 
**Unit is completely unplugged...
 
*weewx[5181]: acurite: Failed attempt 1 of 10 to get LOOP data: [Errno 5] Input/Output Error
 
*weewx[5181]: acurite: Failed attempt 1 of 10 to get LOOP data: [Errno 5] Input/Output Error
 
*
 
*

Latest revision as of 19:33, 26 February 2023

This particular set of instructions is based on building a standalone VM to handle WeeWX. On my network, I have an existing WebServer & an existing Automation Server. The intent is to have the weather information served up as a web page (Default WeeWX thing...) by the WebServer and also be used by the Automation Server.

There is also a dedicated Database Server which we will be using. (can't possibly do things the easy way...)

(Based on: WeeWX: Installation on Debian-based systems)

Installation

(based on an install under Mint 20)

  • wget -qO - http://weewx.com/keys.html | sudo apt-key add -
  • wget -qO - http://weewx.com/apt/weewx-python3.list | sudo tee /etc/apt/sources.list.d/weewx.list
  • sudo apt-get update
  • sudo apt-get install weewx

Also:, If you wish to use MySQL as the database, you'll need to either install it on this machine or connect to the DB on your Database server.

  • sudo apt install mysql-client
  • sudo apt-get install python3-pymysql

Will be useful. (actually, mandatory :P )

Configuration

Setting up for YOUR Weather Station

ComingTM SoonTM MaybeTM

(Just as an example... We have an AcuRite 01024 weather station here. It works well, but it still sucks in a large number of ways...)

Setting up the database (using MySQL)

(based on: Configuring MySQL / MariaDB)

On the Database Server:

(NOTE: Your Database Server must be configured to allow remote access.)

  • sudo mysql -u root -p
CREATE USER 'weewx'@'Machine.Domain.TLD' IDENTIFIED BY 'weewx';
CREATE DATABASE weewx;
GRANT select, update, create, delete, insert, drop ON weewx.* TO weewx@'Machine.Domain.TLD';

Tell WeeWX to use the MySQL database

  • sudo vim /etc/weewx/weewx.conf

in [[wx_binding]]

change

database = archive_sqlite

to

database = archive_mysql

in [[MySQL]]

change

host = localhost

to

host = Machine.Domain.TLD

(Machine.Domain.TLD, of course, being the address of your Database Server...)

Webserver Updating

(Based on: If the server is on a different machine)

Using FTP to upload/update the WeeWX generated webpages.

(Your Web Server will need to have FTP enabled...)

  • sudo vim /etc/weewx/weewx.conf
[StdReport]
    [[FTP]]
        skin = Ftp
        server = Machine.Domain.TLD
        path = /var/www/html/weewx
        user = USERNAME
        password = PASSWORD

MQTT

As a start... pip doesn't seem to be a default thing... Kinda silly that...

  • sudo apt-get install python3-pip

Then, we'll work from iain MacDonnell's instructions on GitHub

Download the WeeWX MQTT Extension:

  • wget -O weewx-mqtt.zip https://github.com/matthewwall/weewx-mqtt/archive/master.zip

Install paho-mqtt

  • sudo pip3 install paho-mqtt

Install the extension

  • sudo wee_extension --install weewx-mqtt.zip

restart WeeWx

  • sudo /etc/init.d/weewx restart

Then edit weewx.conf to configure things for your own MQTT server

  • sudo vim /etc/weewx/weewx.conf
    [[MQTT]]
        server_url = mqtt://Machine.Domain.TLD:1883
        topic = weather
        unit_system = METRIC

Administration

Checking status:

  • sudo tail -f /var/log/syslog | grep weewx

Starting:

  • sudo /etc/init.d/weewx start

Stopping:

  • sudo /etc/init.d/weewx stop

Restarting:

  • sudo /etc/init.d/weewx restart

Links

Troubleshooting

  • weewx[10206]: acurite: Failed attempt 1 of 10 to get LOOP data: [Errno 32] Pipe error
    • USB hardware issues
    • Bloody cheapass USB extensions... :P
    • Check the USB Mode setting on the indoor unit. Make sure it hasn't lost its little mind.
    • This needs to be set to Mode 3.
  • weewx[951]: acurite: Cannot find USB device with VendorID=0x24c0 ProductID=0x0003 DeviceID=None
    • Unit is completely unplugged...
  • weewx[5181]: acurite: Failed attempt 1 of 10 to get LOOP data: [Errno 5] Input/Output Error