Obligatory WeatherFlow e-ink Display

I’m new to the community, but I wanted to share my e-ink display project. Full disclosure, I am not a programmer, I have no training whatsoever in Python, and furthermore failed C++ in college not once, not twice, but 3 times. Those caveats aside, this project is easily achievable by a novice. I do not want to give any false assumptions that the source code is mine, or that I have developed it in any way, that is not the case. I have taken the source and modified it to suit my needs and use the WeatherFlow data.

Edit: I made some pretty big improvements tonight so I felt as though a fresh, less glared picture was in order

First and foremost…

Bill of sale:

  • List item 1x 5x7 photo frame - I am in the midwest, I purchased a rather generic frame at my local Meijer
  • 1x Raspberry Pi Zero 2W
  • 1x WaveShare 7.5inch e-Paper HAT (B) - (I had bought the 3 color Red, Black, White version expecting to have red integrated. As I am not a skilled programmer leveraging someone else’s code, I shoehorned my 3 color screen into a 2 color screen code.)
  • MicroSD memory card
  • Ideally a 3D printer to make custom parts

Source Code:
The source code I used for this project was called e_paper_weather_display

Important Modifications:
This code is written to use OpenWeather API. Simply changing the URL does not allow the code to work with WeatherFlow. The following code is the key to success:

At the import section of the code, look for json - modify the line to look like this:

import requests, urllib.request, json

At the section where URL =, set it to use your station ID and API token. If needed, you can also change the units to what you prefer.:

URL = ‘https://swd.weatherflow.com/swd/rest/better_forecast?station_id=[StationID]&units_temp=f&units_wind=mph&units_pressure=inhg&units_precip=in&units_distances=mi&token=[API Token]’

From here, you will modify the JSON pull to use the upgraded method. This is the key to get the app to work. The original method returned garbage. See below:
# Check status of code request
if response.status_code == 200:
print(‘JSON pull from Tempest WX successful.’)
# get data in jason format
f = urllib.request.urlopen(URL)
wxdata = json.load(f)
f.close()
# get current dict block
current = wxdata[‘current_conditions’]

From this point you only need to plug in the JSON items you want to see. Reference [Place Holder for Tempest API link due to newbie restrictions] for the specific JSON items. Note: if you keep the source naming convention, selecting your data will look similar to (without the double quotes) “current[‘air_temperature’]” - setting this to a variable, eg temp_current = current[‘air_temperature’] - will allow you to use the the API data for the current temperature.

My Modifications:
I had a lot of fun with this project, so I went pretty far with it. I designed and printed a back for the frame as well as a mask for the e-ink screen. These allowed me to create mounting points for the driver HAT as well as the Raspberry Pi. Note: If the picture is not embedded in this original post, it will be in subsequent replies.

Top left:
I modified the source code to allow the use of day weather icons and night weather icons. This was achieved by using the sunrise and sunset data. Simple logic of if > sunrise and < sunset = daytime, < sunrise and > sunset = nighttime.

Barometer data. I added in barometer readings along with an icon for the trend. The icon I used was from [Place Holder due to restrictions as new user] were either from this list or modified from one on this list.

Top Right:
The feels like temperature is a product of humidity and dew point. The modification I made here was adding in a fire icon to the right of the feels like temp if it is equal to or exceeds 5 degrees above current temp. Conversely, if it is equal to or minus 5m it will display a snow flake icon.

Bottom left:
No changes

Bottom Middle:
Added Dew Point as a new line and Cardinal DIrections to the Wind reading.

Bottom Right:
If there is lightning detected in the last 3 hours, the panel changes from last updated time to a lightning icon with the number of strikes in the last 3 hours and the current distance reading for the strikes. Once the lighting stops, the 3 hour period will expire and the panel will go back to the last updated time.

For fun:
If the wind exceeds 10MPH, the weather icon will change to the ‘IT HECKIN WIMDY’ meme. This clearly has no scientific value, but it is fun to see a fox meme pop up.

Final notes:
I will provide images and descriptions of how I modified this code to make it work for me. However, since I did not create the source code I do not feel as though it is fair to claim it as my own. I modified what I found to make it suit my needs since the Tempest specific repository was taken down. This was a ‘oh crap I ordered all these parts and I need to make it work or the wife will kill me’ moment. With a bit of trial and error, this is a rather simple project. Creating a script to execute (without quotes) “python weather.py” in the root crontab @reboot is really all that is needed.

If anyone has any questions or feedback, please let me know and I will do my best to answer!

Edit: Upon request, I have created a fork from the original code for my version to work with Tempest: https://github.com/OG-Anorine/Tempest-7.5-E-Paper-Display

6 Likes

Tempest API reference Link: Tempest API

Weather Icon source: Weather Icons

3D Printed back:

Lightning tracking mod:

1 Like

Super good looking. Have you noticed anything re: burn-in on the display, and how often does it refresh ?

Thanks! I appreciate the feedback! I am refreshing every 5min. I also run a reboot at 3:30am in order to completely reinitialize the screen. So far I have seen zero burn-in.

awesome work! a purely meme-based weather layout could be fun. when temp <= 20 (F) or UV >= 10, simply “don’t go outside” is sufficient in big letters.

I have added more memes for personal use. I have always wanted to experience thundersnow. Using the data, I built in logic for my personal display that will have the Ron Paul “IT’S HAPPENING” meme pop up.

I do have the git repository up to date, though I did pull out the Ron Paul meme. The new release here has a skull and crossbones next to the feels like when the dew point is equal to or greater than 76 (help us all if that happens): Shameless Plug for Code

I’ve recently included a number of fixes for things that I have noticed along the way. Future state I plan on prioritizing NWS alerts, but I need the json for multiple alerts in order to code it properly. Unfortunately, when I thought that hey, that’s a good idea, the double alerts in my area had expired 3 minutes prior.

If you look at my fork, I grab only the most current NWS alert that is still active. Look around line 217 or so in weewx-epaper/weather-cron.py at twocolor · vinceskahan/weewx-epaper · GitHub

I also updated mine to have two variants, one that loops and sleeps, and one (like yours) that is called by cron. I’m finding the called by cron variant the best way to do it, as it is graceful if the code blows up by getting something unexpected. Worst that happens is you get a blank screen for a few minutes til cron runs it again. Stops you from getting stale displays that can burn in too. I also added a ‘clearscreen.py’ script for that just.in.case.

Same for forecasts. I get only the first active one. Forecasts are tougher because NWS uses some crazy long strings that don’t fit. I just hack brutally on the string if it’s too long. Should be obvious.

I ended up creating a service to run it and I have found it is way more stable. I was kicking everything off via cron at the beginning, but things would get stuck every once in a while.

For multiple alerts I plan on using the severity field to make sure the most severe alert is displayed first. Again, I need to see double alerts to fully understand the logic I will need to write. I may have to combine that with urgency to get proper results. In the end, I think that will be a great addition for keeping on top of what’s going on.

My ‘guess’ is that the most important one is first in their list, but I didn’t do much more than a quick few looks to see if that’s indeed what they are doing. Sure wish they’d publish their dictionary of what words they use for the alerts and forecasts rather than having to figure it out experimentally.

I’ve found cron 100% reliable and simpler than worrying if systemd will work or not. Only downside is that I don’t (currently) save the previous logfile someplace if it had failed so I can see what I logged if it aborted. At this point it’s just me not doing a good enough job at wrapping things in try/except blocks.