Pull current weather from OpenWeatherMap, store in InfluxDB and make available via local API.
50K+
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:
[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 \
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 \
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
Content type
Image
Digest
sha256:c96721ba3…
Size
24 MB
Last updated
23 days ago
docker pull jasonacox/weather411