Lots of Improvements, so a new Howto.
Ian and the others at the Weather34 on Weewx project on GitHub have done a ton of work improving the skin including for remote web server operation. As a result this tutorial is MUCH shorter compared to the previous one.!
This tutorial is meant for that new, improved skin as well as weewx version 4.1.1 or higher using a local weewx machine sending its web pages to a remote web server.
This Howto assumes you already have a working weewx/remote web server setup for normal weewx operations using rsync and you are adding the Weather34 skin for weewx 4.
The remote web server may be on the same local network as your weewx computer, or more likely, it is a hosted server somewhere on the internet that you use for your website. I will be describing the more complex setup of a remote hosted server.
Already have Weather34 installed? Remove it first.
If you’re upgrading from an older version of the skin I recommend removing the old skin completely and starting fresh. There are so many new things happening with the skin now that it can get confusing. Click here to go to the Uninstalling Section of this Tutorial.
Just looking for weewx.conf configurations?
I know sometimes you’re just looking for the final setup to compare with your own. So click here to go to the What’s in Weewx.conf section.
Installing Weather34 on the local WeeWx server side first.
Let’s do this!
You must be running at least version 4.1.1 or later of WeeWx. I strongly recommend using python3 as well. All commands below assume python3.
Part A: Installing the Extension on Weewx
- Stop the Weewx service if it is running.
- Make sure you have installed the pyephem module for python3.
- Install the xmltodict pip extension.
sudo pip3 install xmltodict
- You need to know the IP address or domain name of your remote server.
- You also need to know your own home IP address for the remote server to call back to.
- If your local weewx machine is on a local network (eg. 192.168.1.x or similar) you will need the *external* public facing IP address of your home Internet Router.
- If your local weewx machine has a pubic facing IP address, use that.
- Create a new services.txt file by going to https://steepleian.github.io/weewx-Weather34
- If you have one, grab your weewx.conf and old settings1.php file to help you fill it out!
- For the “local web server IP address” use the IP Address from step 5.
- On a command line go to your Downloads folder.
- Run this command to download Weather34:
sudo git clone https://github.com/steepleian/weewx-Weather34.git
- Copy the services.txt file into the new weewx-weather34 directory.
- Run the w34 installer:
sudo python3 w34_installer.py
- To make sure it has installed you can go to the skins folder in your local weewx folder and see that the weather34 directories are made. Don’t make any changes yet.
- Open weewx.conf
- If your html_root web directory for the local weewx machine is different than the normal weewx setup, change it in the [[Weather34Report]] and [[w34Highcharts]] sections of weewx.conf to match.
- Look for the [Weather34RealTime] section near the bottom of the weewx.conf file. In this section:
- Make a note of the weewx_port = 25252 (We will need this later)
- Set the address of your remote webserver (domain name or IP address):
webserver_address = www.yourwebserver.com
- Set the public IP address of the weewx server (from step 5):
weewxserver_address = local.public.ip.address
- Set HTML_ROOT to the weather34 root directory on your remote webserver:
HTML_ROOT = /var/www/vhosts/yourserver.ca/public_html/weather34/
- WARNING – This step is experimental. The weather34 service leaves the weather34 directory in the local weewx public_html folder. Since this is only created initially to populate the remote server leaving it around seems to cause problems. Weewx tends to ‘revert’ files back to their original install state, particularly the json_data web service files until an update comes along and those files are updated by weather34’s process.
I have removed the local weewx/public_html/weather34 directory completely. I won’t recommend you do this at this time but it has worked for me so far.
- On your remote server add a firewall rule allowing traffic on port 25252.
- On your home internet internet router, create a NAT Port Forwarding rule for port 25252 pointing to the local IP address of your local weewx machine.
- START WEEWX!
You should start to see things happening! It’s a good idea to have the weewx.log open so that you can watch it for errors from weather34.
If Weewx does not start, go through your changes in the weewx.conf file to make sure they are correct and check your log file.
Part B: Once the local Weather34 and Weewx are Running
Your remote Weather34 server will receive updates in 3 ways.
- Actively from the local weather34 service:
- Immediately after the initial install it will generate all the files it needs and rsync them to the remote server.
- At rapid intervals with rsync through the /tmp directory (often /tmp/weather34/)
- Interactively on the remote weather34 website
- Users actions on the website will cause weather34 to call back and fetch data in realtime from the local weewx machine.
- Passively from weewx
- Weewx will upload any changes to the weather34 directory that it sees in its public_html folder.
Final Setup of Weather34 Remote
- Go to your website’s weather34 page.
- If you see a timeout error, error 500 or blank page, double check that your local weewx machine is running and that the weewx.conf is configured correctly from step 13 and 14 above.
- Once you see the placeholder webpage…
- Click the Settings link in the menu.
- The default password is 12345 (change this!)
- The most critical setting is “Weewx Software paths to data files”
This must be your remote server path. Something like:
- Fill in the rest of the information as you see fit. Be sure that the services you select to view on your web site match what you have set in weewx.conf under [Weather34WebServices].
eg. services = ds.me.eq.ki.wu.pu
- You’re done! You should now have a fully functioning weather34 local/remote server.
Thanks for following along, if you have any comments or corrections for these instructions please leave a comment below! 🙂
Uninstalling the Weather34 skin
I created this tutorial as I was upgrading my own system. So I thought I might as well create an addition to this tutorial that explains how to *remove* Weather34 from your system, both on the weewx side and the remote server side.
Part A: Local Weewx Cleanup
Let’s make sure weewx is ready. It is good to do this *before* you upgrade you weewx installation too.
- Stop Weewx (this is important for the remote side too)
- Backup! It is always good to backup your files before a major change.
- Sometimes if it’s just not working, I just revert to a previous backup and weewx goes back to how it was before. I use Time Machine which accomplishes this very very easily.
- If you are not on a Mac or don’t use Time Machine, the simplest thing to do is to archive your entire weewx folder.
Use this command: tar -czf weewxbackup.tar.gz weewx
This should essentially create a snapshot of the files before you start the cleanup and upgrade process! If something goes wrong, just unarchive the file and restore the original folder to its spot and you should hopefully be back exactly where you started.
- Since Weather34 does not use the WeeWx Extension framework, it must be removed manually.
- Remove weather34 related skin files (you might not have all these files or directories):
- Remove weather34 related extension files
- Remove weather34 related public files and folders
- Remove other weather34 related files:
- Remove references to weather34 in weewx.conf
- [[Weather34Report]] and [[w34Highcharts]] sections under [StdReport]
- user.weather34.Weather34RealTime under [[Services]]
- [Weather34RealTime] section
- [Weather34WebServices] section
- [Weather34CloudCover] section
That should remove everything to do with weather34 on the local weewx side, now let’s move on to the Remote Side.
Part B – Remote Web server Cleanup
- Is Weewx stopped? Make sure weewx is not running otherwise it might repopulate things you just deleted.
- Backup! – Always a good idea to backup your files! You can either:
- Download the weather34 directory using FTP or SFTP (slow)
- Archive the directory on the server (fast)
I have ssh access to my server, you probably do to. So I just run the command from within my public-html directory where the weather34 folder is:
tar -czf weather34.tar.gz weather34
That will create an archive.
- Remove or empty the weather34 directory.
- Remove the w34realtime.txt file from the realtime folder, if you have one.
That’s it! Now you should be ready to do a fresh weather34 install. You can double check that weather34 is completely removed by restarting weewx. It should still be able to run and update the standard skins (if you’ve had it running before of course).
What’s in my weewx.conf file?
Sometimes you just want to compare notes: Here are the stanzas from my working weewx.conf setup.
[[Weather34Report]] skin = Weather34 HTML_ROOT = /my/localserver/html/weewx/weather34/ [[[Units]]] [[[[Groups]]]] group_altitude = meter group_degree_day = degree_C_day group_pressure = kPa group_rain = mm group_rainrate = mm_per_hour group_speed = km_per_hour group_speed2 = km_per_hour2 group_temperature = degree_C
[[w34Highcharts]] HTML_ROOT = /my/localserver/html/weewx/weather34/w34highcharts skin = w34Highcharts enable = true [[[CheetahGenerator]]] [[[[ToDate]]]] [[[[[YearJSON]]]]] stale_age = 600 [[[Units]]] [[[[StringFormats]]]] centibar = %.0f cm = %.2f cm_per_hour = %.2f degree_C = %.1f degree_F = %.1f degree_compass = %.0f foot = %.0f hPa = %.1f inHg = %.3f inch = %.2f inch_per_hour = %.2f km_per_hour = %.0f km_per_hour2 = %.1f knot = %.0f knot2 = %.1f mbar = %.1f meter = %.0f meter_per_second = %.1f meter_per_second2 = %.1f mile_per_hour = %.0f mile_per_hour2 = %.1f mm = %.1f mmHg = %.1f mm_per_hour = %.1f percent = %.0f uv_index = %.1f volt = %.1f watt_per_meter_squared = %.0f NONE = N/A [[[[Labels]]]] centibar = cb cm = cm cm_per_hour = cm/hr degree_C = ° C degree_F = ° F degree_compass = ° foot = feet hPa = hPa inHg = inHg inch = in inch_per_hour = in/hr km_per_hour = km/hr km_per_hour2 = km/hr knot = knots knot2 = knots mbar = mbar meter = meters meter_per_second = m/s meter_per_second2 = m/s mile_per_hour = mph mile_per_hour2 = mph mm = mm mmHg = mmHg mm_per_hour = mm/hr percent = % uv_index = Index volt = V watt_per_meter_squared = W/m² NONE = "" [[[Extras]]] numYears = 5 [[[[MinRange]]]] outTemp = 10, degree_C windchill = 10, degree_C barometer = 20, hPa windSpeed = 10 rain = 5, mm radiation = 500 UV = 16 [[[[WindRose]]]] title = Wind Rose source = windSpeed period = 3600, 86400, 604800, month, year aggregate_type = "" aggregate_interval = "" petals = 16 petal_colors = aqua, 0x0099FF, 0x0033FF, 0x009900, 0x00CC00, 0x33FF33, 0xCCFF00 speedfactor = 0.0, 0.1, 0.2, 0.3, 0.5, 0.7, 1.0 legend_title = True band_percent = True bullseye_percent = True precision = 1 bullseye_size = 20 bullseye_color = 0xFFFACD calm_limit = 0.1
[Weather34RealTime] unit_system = METRICWX exclude_fields = rain cache_enable = True cache_stale_time = 900 weewx_port = 25252 webserver_address = www.alberniweather.ca weewxserver_address = My.homeRouter.IP.Address weewx_file_transfer = "" HTML_ROOT = /path/on/my/remote/host/to/weather34/