Pulls weather data from Ecowitt.net Weather API and stores in InfluxDB for graphing.
3.1K
This server pulls current weather data from Ecowitt.net Weather API, 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/ecowitt
Create a ecowitt.conf file in /weather/contrib/ecowitt (cp ecowitt.conf.sample ecowitt.conf) and update with your specific device / API details:
[LocalWeather]
DEBUG = no
[API]
# Port to listen on for requests (default 8686)
ENABLE = yes
# Different Port to Weather 411 so they can co-exist
PORT = 8686
[Ecowitt]
# Set your APIKEY and APPLICATION_KEY from https://www.ecowitt.net/user/index
APIKEY = xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
APPLICATION_KEY = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Set the MAC address for the specific station you want to query
MAC = 01:23:45:67:89:AB
WAIT = 1
TIMEOUT = 10
# standard, metric or imperial
UNITS = metric
[InfluxDB]
# Record data in InfluxDB server
ENABLE = yes
HOST = influxdb
PORT = 8086
DB = powerwall
FIELD = localweather
# 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 8686.
docker run \
-d \
-p 8686:8686 \
-e WEATHERCONF='/var/lib/weather/ecowitt.conf' \
-v ${PWD}:/var/lib/weather \
--name ecowitt \
--restart unless-stopped \
jasonacox/ecowitt
Test the API Service
Website of Current Weather: http://localhost:8686/
# Get Current Weather Data
curl -i http://localhost:8686/temp
curl -i http://localhost:8686/all
curl -i http://localhost:8686/conditions
# Get Proxy Stats
curl -i http://localhost:8686/stats
# Clear Proxy Stats
curl -i http://localhost:8686/stats/clear
Incorporate into Powerwall-Dashboard
Save the following into a file called powerwall.extend.yml in your Powerwall-Dashboard folder
version: "3.5"
services:
ecowitt:
# Uncomment next line to build locally
# build: ./weather/contrib/ecowitt
image: jasonacox/ecowitt:latest
container_name: ecowitt
hostname: ecowitt
restart: always
user: "1000:1000"
volumes:
- type: bind
source: ./weather/contrib/ecowitt
target: /var/lib/ecowitt
read_only: true
ports:
- target: 8686
published: 8686
mode: host
environment:
- WEATHERCONF=/var/lib/ecowitt/ecowitt.conf
depends_on:
- influxdb
Then restart the services using compose-dash.sh and the new component will be picked up:
./compose-dash.sh stop
./compose-dash.sh up -d
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 jasonacox/ecowitt:latest .
# Build for all architectures - requires Docker experimental
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t jasonacox/ecowitt:latest .
Setup the Docker Container to listen on port 8686.
docker run \
-d \
-p 8686:8686 \
-e WEATHERCONF='/var/lib/weather/ecowitt.conf' \
--name ecowitt \
-v ${PWD}:/var/lib/weather \
--restart unless-stopped \
jasonacox/ecowitt
Test the API
curl -i http://localhost:8686/temp
curl -i http://localhost:8686/stats
Browse to http://localhost:8686/ 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 ecowitt
# Stop the server
docker stop ecowitt
# Start the server
docker start ecowitt
influxdb client library to influxdb-client, providing support for InfluxDB 1.8 and 2.x. Add Verify Support.influxdb client library to influxdb-client, providing support for InfluxDB 1.8 and 2.x.Content type
Image
Digest
sha256:1298eff42…
Size
23.9 MB
Last updated
over 3 years ago
docker pull jasonacox/ecowitt