Customising WeeWX for Digitalham


When I settled on weewx to run my weather stations I needed to do a spot of customising to make it fit in well with the style of Digitalham. Then I moved my Snettisham Weather page across to another site where I use a different colour scheme and had to do part of the job again.

Plot image size
The very first change I made was to the default plot image size which I felt was too small. I settled on 480×320. This size is defined in the [ImageGenerator] section of /home/weewx/skins/Standard/skin.conf

Colour changes
After that my next port of call was adjusting the colours to match those used by Digitalham. That meant changes to /home/weewx/skins/Standard/weewx.css and /home/weewx/skins/Standard/skin.conf – if you are happy with the default colours you can pretty much ignore these files although because of other changes I made I did modify the sizes of stats_group to 40% and content to 52% in weewx.css. One hiccup I came across was that specifying colours in the normal HTML way of #RRGGBB caused the plot function to crash. I didn’t pursue this and just used the 0xBBGGRR style which was already in use there. One other thing I did was to set bottom_label_font_color the same as image_background_color in skin.conf as I was unable to successfully amend the date format there and think those labels add little value anyway.

Date format
My third issue was the ugly and confusing US style dates. In theory the default format depends on the LANG environment variable. I did try using raspi-config Internationalisation options and checked after using echo $LANG where I found mine is en_GB.UTF-8 which I would have hoped resulted in at least European format dates but didn’t – I got US format MM/DD/YY. To get around that I resorted to adding strftime() formatting directives manually to the appropriate fields – e.g. $current.dateTime.format("%a %d %b %Y" " at " "%X") in the headers. It was because of the longer date/time fields that I modified the relative column sizing as mentioned above.

Other modifications
In addition to amending the date formatting I felt that the index page carried too much on the right hand side and moved the About and Almanac sections to the left along with some minor formatting changes to them. I dropped the station connection quality graphs from all reports. As I present the weewx reports in an iframe it is advantageous to me that each section be the same height so I dropped the annual indoor temperature plot to achieve that. My final bit of data dropping was the radar section in the smartphone page as I don’t have that data.

Download my templates
How you use my templates which I have made available for download here is both entirely up to you and at your own risk. Keep backups of your original files.

Easy file tranfers
Now a confession – I am a mainframe dinosaur. My editor of choice is an obsolete windows program called KEDIT which emulates the IBM CMS mainframe editor XEDIT and also supports the REXX scripting language which I learned to use in the 1970s – it is very similar to the IBM TSO editor. I made some changes using the linux nano text editor but for most I set up an SFTP connection in FileZilla and pulled the files across to my PC for editing then transferred them back after. There is one minor inconvenience with these weewx files – they are all owned by root. In order to be able to freely update them in the way I did (or simply install my templates on your machine) you’ll need to temporarily allow that – I chose the crudest method possible – sudo chmod -R 777 /home/weewx. When finished it’s safest to switch back to sudo chmod -R 644 /home/weewx.

A cautionary note
When I set up WeeWX for my second Raspberry Pi for the caravan I just installed it and copied over the weewx.conf from the first install along with the templates then worked on those on the new Pi. This saved me redoing a fair bit of work. I did the same just recently when I got a Pi 2B with the intention of that taking over the original work plus maybe running WXtoImg and freeing up the Pi B for use as a WSPR beacon running WsprryPi. WeeWX running on the new Pi 2 kept giving errors with the database. After much messing about I realised that WeeWX was on a later release and the database section in the config file had changed. Once I realised that and redoing my mods on the new config file sorted the problem out although I did initially have wind speeds reporting in meters per second until I spotted that and changed it to mph.


  2 Responses to “Customising WeeWX for Digitalham”

  1. Have you tried using Weewx to send APRS data via RF?

  2. I wasn’t even aware that this was an option.

 Leave a Reply