This folder contains tools to add current local weather data to your Powerwall Dashboard.
- Weather411 - This script uses OpenWeatherMap to determine your area weather. The details are below.
- Community Contributed - If you have your own local weather station or want to add another weather service, there is a way to add that data as well. See the example Ecowitt service by @BJReplay in the contrib/ folder.
This server pulls current weather data from OpenWeatherMap.org, makes it available via local API calls and stores the data in InfluxDB for graphing.
This service was built to easily add weather data graphs to the Powerwall-Dashboard project.
Docker: docker pull jasonacox/weather411
-
Create a
weather411.conf
file (cp weather411.conf.sample weather411.conf
) and update with your specific location details:- Enter your OpenWeatherMap API Key (APIKEY) You can get a free account and key at OpenWeatherMap.org.
- Enter your GPS Latitude (LAT) and Longitude (LON). To get your location, you can use this tool.
[Weather411] DEBUG = no [API] # Port to listen on for requests (default 8676) ENABLE = yes PORT = 8676 [OpenWeatherMap] # Register and get APIKEY from OpenWeatherMap.org APIKEY = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Enter your location in latitude and longitude LAT = xxx.xxxx LON = yyy.yyyy WAIT = 10 TIMEOUT = 10 # standard, metric or imperial UNITS = metric [InfluxDB] # Record data in InfluxDB server ENABLE = yes HOST = influxdb PORT = 8086 DB = powerwall FIELD = weather # Auth - Leave blank if not used USERNAME = PASSWORD = # Influx 2.x - Leave blank if not used TOKEN = ORG = URL =
-
Run the Docker Container to listen on port 8676.
docker run \ -d \ -p 8676:8676 \ -e WEATHERCONF='/var/lib/weather/weather411.conf' \ -v ${PWD}:/var/lib/weather \ --name weather411 \ --restart unless-stopped \ --net=host \ jasonacox/weather411
-
Test the API Service
Website of Current Weather: http://localhost:8676/
# Get Current Weather Data curl -i http://localhost:8676/temp curl -i http://localhost:8676/all curl -i http://localhost:8676/conditions # Get Proxy Stats curl -i http://localhost:8676/stats # Clear Proxy Stats curl -i http://localhost:8676/stats/clear
This folder contains the server.py
script that runs a multi-threaded python based API webserver.
The Dockerfile
here will allow you to containerize the proxy server for clean installation and running.
-
Build the Docker Container
# Build for local architecture docker build -t weather411:latest . # Build for all architectures - requires Docker experimental docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t weather411:latest .
-
Setup the Docker Container to listen on port 8676.
docker run \ -d \ -p 8676:8676 \ -e WEATHERCONF='/var/lib/weather/weather411.conf' \ --name weather411 \ -v ${PWD}:/var/lib/weather \ --restart unless-stopped \ --net=host \ weather411
-
Test the API
curl -i http://localhost:8676/temp curl -i http://localhost:8676/stats
Browse to http://localhost:8676/ to see current weather conditions.
If you see python errors, make sure you entered your credentials correctly in docker run
.
# See the logs
docker logs weather411
# Stop the server
docker stop weather411
# Start the server
docker start weather411
- Add SIGTERM to fix condition where container does not stop gracefully as raised in #353 by @rcasta74 and #354 PR.
- Fix access to InfluxDB where username and password and configured and required. Impacts by InfluxDB v1 and v2. Issue reported by @sumnerboy12 in #199.
- Upgrade end of life
influxdb
client library toinfluxdb-client
(refer discussion #191 and issue #195), providing support for InfluxDB 1.8 and 2.x.
- Fix rain and snow values not being retrieved (refer issue #42) by @mcbirse (PR #69)
- Added additional error handling for pulling and processing OpenWeatherMap data.
- Moved from OpenWeatherMap /data/2.5/onecall to free /data/2.5/weather URI (see #51)
- Set up to run in docker and incorporated into Powerwall-Dashboard.
- Initial Release