Simple live weather display for a dedicated monitor. Intended to be run 24/7 on a low-spec computer, like a Raspberry Pi.
These are suggestions for how you might setup this display.
- Setup your computer. Ensure it has a desktop environment.
- Establish an internet connection.
- Install a web browser. This will render the weather display.
- Setup a local web server and have it run on startup.
- Clone this repository into the web server's public directory.
- Go to weatherwidget.io, set your location, set your labels, customize the widget however you'd like, select GET CODE, then COPY TO CLIPBOARD.
- In
weatherdisplay.html
, replace whatever is in the<body>...</body>
tags with the code you copied in (6). - Make sure everything displays properly on
localhost
in your browser of choice. Adjust the browser zoom for the weather display to fit your monitor. Take note of the URL. - Have the URL from (8) load in the browser of choice on startup, in fullscreen.
- Reboot your computer and check that the weather display loads as expected.
These instructions will likely work with other Raspberry Pi models as well.
Install Raspberry Pi OS onto a SD card with at least 4GB. This has been tested on Raspberry Pi OS Bullseye (2022-09-22 release).
Attach either an ethernet connection or a USB WiFi dongle. Ensure the device connects to the internet.
Ensure the device boots directly to the desktop by default.
Run the following:
sudo apt install nginx unclutter xautomation epiphany-browser
After installing nginx
, it should be enabled to run on boot. We'll now configure this server to host our weather display. Run the following:
cd /var/www/html
git clone https://github.com/jcbrockschmidt/weather-display.git
You should now be able to access http://localhost/weather-display
in a browser.
NOTE: This site will be visible to everyone on your LAN network. If this is a security concern, configure iptables
to block incoming HTTP traffic.
Open epiphany-browser
and go to http://localhost/weather-display
.
Adjust the zoom to fit your preference. Fullscreen the browser beforehand as this is how the site will be displayed.
Disable tab restore. This will prevent additional tabs from being loaded if the device isn't shutdown gracefully. Open Preferences by clicking the drop-down menu in the upper right and selecting Preferences. Under Session, select Start in Incognito Mode. For some reason, disabling Restore Tabs on Startup doesn't always do what it says. Incognito mode solves this issue.
Create the script displayweather.sh
in /home/pi
. Put this in it:
#!/usr/bin/bash
# Disable DPMS (Display Power Management Signaling)
xset -dpms
# Disable screen saver
xset s off
# Do not blank the video device
xset s noblank
# Hide mouse
unclutter &
# Wait for desktop environment initialize somewhat
sleep 60s
# Load weather display
epiphany-browser "http://localhost/weather-display" --display=:0 &
# Wait for epiphany-browser to load
sleep 180s
# Make weather display fullscreen
xte "key F11" -x:0
Now open /etc/xdg/lxsession/LXDE-pi/autostart
or ~/.config/lxsession/LXDE-pi/autostart
in an editor as root. At the end of the file, add this line:
@/home/pi/displayweather.sh
Reboot the Raspberry Pi and make sure everything loads as expected. The weather display should load by itself in fullscreen, without a visible address bar, and without a mouse showing.
It may take up to 10-15 minutes to fully load, so give it time before deciding to debug. If everything loads, let it sit for a few hours and see if it updates properly and doesn't go into sleep mode. You may also want to test that it loads properly after the power has been cut off abruptly.
This display uses the weather widget from weatherwidget.io.