Weather Software > Station Software Development

Weathersite DIY construction thread using a Pi 4b.

(1/6) > >>

Sleuth255:
Weathersite is a free HTML based Davis console replacement that works with the Davis Weatherlink Live (WLL).  It is designed to run on a low power server such as a raspberry pi (or any other computer that can run GIT utilities and Node.js) and can be accessed from any cheap android or apple tablet that you might want to repurpose as a dedicated console.  I recommend an 8" android tablet that can run the fully kiosk browser app.  Here's some shots.
 
Client side running on Fully Kiosk app with 8" android tablet:

Server side running on a Raspberry Pi 4b:


The weathersite application design/build thread is located on the Davis Instruments Weather Stations forum. 

This topic in the Station Software Development forum provides detailed instructions on how to build your own Weathersite using a raspberry Pi 4b.  If you have questions or comments regarding the weathersite application itself, I'd appreciate it if you would post them over there.

Hardware components

You will need the following components:

A Raspberry Pi 4b with 2GB of memory

I purchased mine from The Pi Shop for 35 USD

A clear case for your Pi

Shown is a SB Components case that I purchased from Amazon for 5.35 USD

(Optional) an AdaFruit Display hat.  Without it, you will need to locate the IP address of your Pi and also the IP address of your WLL.  This thread will assume that you have purchased this component for a full "headless" installation.

I purchased mine directly from Adafruit for 7.99 USD but it is also available on Amazon for ~19 USD.

You will also need a USB C cable to power your Pi that will connect to a powersupply that can deliver ~3A.  See the specs. on the Pi 4B for more information.

Assembly instructions

First, snap the Pi into the lower part of the case


..and connect the display hat to the first set of GPIO connectors as shown:


now snap the top on.  Your completed server looks like this:


Next, download my customized image (latest Pi OS with Git/Node components installed along with weathersite bits) from Google:

https://drive.google.com/file/d/1TcrgulpigtWMqMLU_unBAi-wO1kBXDZW/view?usp=sharing

Now flash the image to an SD card (minimum size 6GB) by using the Raspberry Pi Imager (available here). Select "Choose OS" then "Use Custom" from the menu and give it the zip file you just downloaded.

Once it is flashed, use an ethernet cable to connect your Pi to an unused LAN port on the back of the same router that provides the WiFi access point that your WLL uses.  Most routers have LAN ethernet ports for this purpose.  Here's the back of a typical router:


Now insert the SD card you just made, connect up the power and your Pi will boot.  After about 60 seconds, you should see the following:


Weathersite is up and listening on port 5000.  Wait for up to 5 minutes while Weathersite searches for your WLL.  If found, the display will change:


At this point, weathersite is almost fully functional.  browse to your site using the displayed address:port (using the above example, you would browse to http://10.0.0.214:5000) and the initial setup screen will be shown:


Enter your latitude and longitude in the format shown and also change your Observation Units if desired.  Weathersite will already have the WLL address filled.  However, in rare cases where weathersite can't find your WLL, you will also need to enter it. Then press the Update button.  Weathersite should now be functional! 

Next, you should update Weathersite to the latest version.  You can do this easily by using putty to ssh into the server.  The credentials have been left at their defaults (user pi, password raspberry).  Once logged in, simply type in updateweathersite and it will upgrade to the latest version.

Important!

You will also need to change your timezone while you are SSHed in.  Launch the Pi configuration app by typing in "sudo raspi-config" (no quotes) then go to localization options and set your timezone.

You still have forecast, current conditions, and radar data to do but these are optional.  I'll detail how to get these set up in subsequent posts.

Sleuth255:
"Nothing's working, now what?"..  Troubleshooting tips!

"Weathersite isn't picking up any data from my WLL"
This can be caused by a socket hangup error.  Sometimes the WLL refuses http GET requests from Weathersite.  I'm currently unsure why the WLL does this, but it infrequently will refuse GETs after you restart the weathersite service or if a network connectivity failure occurs.  If you ssh in and see a number of the following errors in /var/log/weathersite.log, this is definitely your problem:

--- Code: ---01/14/21 2:07:14 pm: Retrieving current conditions
Current conditions request failure: Error: socket hang up
01/14/21 2:12:14 pm: Retrieving current conditions
Current conditions request failure: Error: socket hang up

--- End code ---

The fix is to reset your Pi.

The second most common cause is caused by your IP network setup.  Weathersite needs to be on the same IP subnet as your WLL.  If you have an issue here, it will manifest itself in two ways:
[*] Weathersite won't be able to find your WLL
[*] After you manually enter your WLL IP address, weathersite still doesn't show real-time data on the compass rose.
[/list]
Check the address of your Pi against your WLL address to determine this.  There are any number of root causes for a subnet mismatch, but one way to fix it is by lighting up WiFi on your Pi, then connecting it to the same access point as your WLL.  this is done with the raspberry pi configuration utility.  SSH into your Pi and launch the configuration utility (sudo raspi-config).  Next, make sure you update raspi-config to the latest version by choosing "update" on the main menu.  Once complete, change your WiFi country code (L4 WLAN Country) from the "localisation options".  You may be asked to re-boot after you make this change.  Go ahead and tell it to reboot.  Once the pi comes back up, you'll be able to set up wifi from the System menu.  Make sure you enter everything correctly!  SSIDs and passphrases are case sensitive.  Once you have set up your ssid and passphrase, you may be asked if you want to re-boot again.  Do this instead:  disconnect your ethernet cable then reset your pi by disconnecting/reconnecting the power supply.  In about a minute, the display should show your new weathersite address.  If this isn't working, there are a few guides out there to help you get set up.  Here's the official one: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md

Look Ma! No Hands!


btw: Weathersite logs are stored in /var/log/weathersite.log.  Lots of helpful info there.  Use "less" to poke around. 

"Sunrise/Sunset info is wrong"
This is almost always due to one of two things:
[*] Your latitude/longitude is not correct
[*] You haven't changed the timezone on your Pi
[/list]
This one is easy to troubleshoot.  All of the tiles on Weathersite are "Active"; tapping them reveals more information.  In this case, you want to tap the sunrise/sunset tile and a realtime clock will appear.  How does the time look?  If its accurate, then your latitude/longitude isn't being correctly recognized by Weathersite.  On the settings screen, make sure you have entered the correct coordinate in the correct box, that your lat/long coordinates themselves are accurate, and that there aren't any spaces in front of or behind the settings (my bad... I'm not doing any error checking on the settings page yet.  Stay tuned for this in an upcoming release).

Conversely, if the displayed time is not accurate, fix it with raspi-config.  Check the bottom of post 1 for details on how to do this.

"I've changed my settings and now I can't access Weathersite any more"
No worries, you can reset settings manually:
SSH into your server and do the following:

--- Code: ---sudo rm /WeathersiteStats/userSettings
sudo service weathersite restart


--- End code ---

These commands will remove all your settings and reset weathersite.  After the ip address is displayed, you should be able to access weathersite normally.

"Everything's dead!  No display and weathersite.log shows the application terminated"
No worries here; you can always bring weathersite back to life by simply pulling in a fresh copy.  SSH into your server and enter the following commands:

--- Code: ---sudo su
service weathersite stop
cd /
rm -rd weathersite
git clone https://github.com/sleuth255/weathersite
service weathersite start


--- End code ---

These commands wipe out your weathersite installation and pull down a fresh copy.  Your settings will be preserved however.  Check weathersite.log to make sure it comes up.  Still having problems?  Follow the "I can't access weathersite" instructions above.

"What the heck is the "Settings Subnet" option for?"
This option can be used to limit the devices that can change weathersite settings and is useful if you want to publish your weathersite on the internet.  It needs to be entered in CIDR format (ip/mask) and it specifies an internal-only IP subnet where workstations can access the settings page.  Check out how it works by accessing my weathersite.  Press settings there and you'll get an access denied message.  So what's the cheat sheet for setting this up?  Easy peasy.  Virtually every home network out there uses one of three special subnets that have been designated as "internal use only".  So, find out the IP of the device you want to be able to change settings from and use the following:  If your device address begins with 10 then use 10.0.0.0/8 for the settings subnet.  Address begins with 192.168 then use 192.168.0.0/16.  Address begins with 172.16 then use 172.16.0.0/16.  Network gurus out there know that this can be locked down even further by entering a more specific CIDR block.  If you know what you're doing, I would encourage this; especially if your local network is 10.x

Keep in mind that in most cases, you don't need to set anything here.  There are a number of security related issues that need careful consideration before you decide to publish your weathersite publicly.  But there are a number of benefits too.  I personally can take a console with me (or even use the browser on my iPhone) when I'm travelling so I always have the local conditions near my house handy (it seems the big rip-snorter T-Storms always come through when I'm out of town lol).  One other thing: If you mess up this setting, then you can render weathersite unusable.  If this happens, follow the method to reset settings that I described above.

Sleuth255:
How to activate the Radar feature and the Weather tile

Weathersite uses METAR data which it obtains from an FTP site to activate the Current Weather tile (this one is displayed by default).  Weathersite uses climacell forecast data to activate the other 3 weather related tiles.  Tap on the weather tile to cycle through them. 

Weathersite uses two URLs to display radar data.  One is a zoomed in map and is shown by default.  It also appears when the up arrow superimposed on the right side of the radar map is pressed.  The other URL is for a zoomed out map and generally shows regional data.  It is displayed when the down arrow superimposed on the right side of the radar map is pressed.  When you enter URLs pointing to these in settings, the Radar button appears on all screens.  Climacell is global so you can activate forecast data from anywhere.  Just head over to https://www.climacell.co/pricing/ and sign up for a free developer key.  Then enter that key for the "Climacell API key setting".  Forecast data will activate within 5 minutes or so once you have done this.

International availability of METAR and Radar data varies.  PM me with instructions if you activate these features in non-North American locations and I'll include them in this guide.  For now however, here are instructions that work in North America:

North America based instructions

Enable Radar

Here is a good guide for finding the URLs you need.  It features Weather Underground maps:

https://www.smarthomebeginner.com/weather-radar-on-home-assistant/#Step_1_Grab_URL_for_Weather_Map

Zoomed-in radar path is a URL to a site featuring your local radar data from the guide, and Zoomed-out radar path is the URL pointing to the regional radar from the guide.  As stated above, when you tap the up arrow on the right side of a Weathersite radar map, the Zoomed-in URL is displayed and when you tap the down arrow, the Zoomed-out URL is displayed.

Enable the Current Weather tile

Enter METAR FTP data to activate the current weather tile.   First find a station near you from the following list:

https://www.cnrfc.noaa.gov/metar.php

make a note of the station identifier.  For example, the one I use is KMKE.  Now test to make sure that the observation file is retrievable by going to the following:

ftp://tgftp.nws.noaa.gov/data/observations/metar/stations/KMKE.TXT

(replace "KMKE" with the station identifier of your station in caps).  Your browser should download a file "<your station id>.TXT".  Note: Chrome just changed the FTP flag default in their most recent release to "disabled".  Go figure...  If you're using chrome and nothing happens when you browse to the site, you will need to enable ftp and try again: chrome://flags and search for "ftp"

If this works, enter the following information into weathersite settings:

METAR FTP site: tgftp.nws.noaa.gov
METAR File Path: /data/observations/metar/stations/<your station ID in caps>.TXT

If you've entered everything correctly, the current weather tile will be activated. 

fkapp:
Thanks for sharing these details.
Radar will be very interesting.

Color display is nice.

Does this also display UV, Solar, heat index etc?

The console is becoming obsolete (realizing I probably didnt need console, but a lot has changed in year).
Seems like this is cheaper route than $200 for 2nd console for those that need multiple consoles

What tablet is that ?


Sleuth255:
Weathersite will show current storm rainfall data when a rainstorm is in progress but not solar info currently.  The tablet is a Samsung Tab A 8.0 but I also have it running downstairs on an Insignia 8" (~50 USD on eBay) :



The Samsung is nicer because it has a really good brightness control that's based on the latest Andriod build.  It learns the brightness levels from you tweaking the setting over time.  In about two days, it was pretty much perfect.

Here's my weathersite.  Feel free to check it out for yourself!

http://weathersite.theparadigmgrid.com

If you want to know more of the details, head over to the davis forum by following the post 1 link to the design/build thread.

Navigation

[0] Message Index

[#] Next page

Go to full version