Grafana Monitoring Dashboard for Tesla Solar and Powerwall Systems
Monitoring Dashboard for Tesla Solar and Powerwall systems using Grafana, InfluxDB, Telegraf and pyPowerwall.
The default dashboard.json shown above, pulls in live power data from the local Tesla Energy Gateway or the Tesla Cloud and displays that on the Grafana dashboard. A power flow animation is rendered by the pyPowerwall container using that live data.
A non-animated version of the dashboard is also available using dashboard-no-animation.json
The host system will require:
sudo
to install this tool. See Docker Errors below for help.Clone this repo on the host that will run the dashboard:
git clone https://github.com/jasonacox/Powerwall-Dashboard.git
Run the interactive setup script that will ask you for your setup details.
cd Powerwall-Dashboard
./setup.sh
The dashboard can be installed in two different configurations.
Powerwall Dashboard (v4.0.0) - SETUP
-----------------------------------------
Select configuration mode:
1 - Local Access (Powerwall 1, 2, or + using the Tesla Gateway on LAN) - Default
2 - Tesla Cloud (Solar-only systems or Powerwalls without LAN access)
For Powerwall 1, 2 or + owners with a Tesla Energy Gateway accessible on their LAN, select option 1
(Local Access).
For Tesla Solar owners or Powerwalls without LAN access, select option 2
(Tesla Cloud) and the dashboard will be installed to pull the data available from the Tesla Cloud API. This mode works for Solar Only and Powerwall 3 owners, but will not provide all the details or fidelity that the "Local Access" mode offers.
Next, you will then be asked for your Local timezone, and your Powerwall details or Tesla Cloud login details. To find your timezone, see the second column in this table: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
setup.sh
to try again.
Follow the Grafana Setup instructions provided (or see below) to complete the setup.
If you prefer, you can perform the same steps that setup.sh
performs.
Note: some manual configuration is required if you are running a non-standard docker installation (e.g. rootless). Also, ensure that the conf
, env
and sql
files are readable by the docker services (e.g. chmod 644
).
You will want to set your local timezone by editing pypowerwall.env
, telegraf.conf
, influxdb.sql
and dashboard.json
or you can use this handy tz.sh
update script. A list of timezones is available here: TZ Table.
# Replace with your timezone
bash tz.sh "America/Los_Angeles"
Copy pypowerwall.env.sample
to pypowerwall.env
and update the following details for your Powerwall:
[email protected]
PW_PASSWORD=password
PW_HOST=192.168.91.1
PW_TIMEZONE=America/Los_Angeles
PW_DEBUG=no
For Tesla Solar owners or Powerwalls without LAN access, to configure pyPowerwall in Tesla Cloud mode instead of Local Access mode, edit pypowerwall.env
and leave the PW_HOST=
setting blank. NOTE: Once the docker containers have started, an additional step is then required to login to your Tesla Account by running the command docker exec -it pypowerwall python3 -m pypowerwall setup
.
Copy compose.env.sample
to compose.env
. You do not need to edit the other defaults unless you are running a non-standard install such as docker rootless or require custom ports.
Copy influxdb.env.sample
to influxdb.env
. You do not need to edit this file, however if you have a custom setup, environment variables can be added to override the default InfluxDB configuration.
Copy telegraf.local.sample
to telegraf.local
. If you want to monitor custom measurements for your site (most users don't need this), add the required telegraf.conf TOML entries to this file. Once created, this file is not overwritten by upgrades or future runs of setup.sh.
Copy grafana.env.sample
to grafana.env
- you do not need to edit these defaults. However, there are optional settings for alert notifications and HTTPS.
Optional: If you want to pull in local weather data, copy weather/weather411.conf.sample
to weather/weather411.conf
and edit the file to include your location (Latitude and Longitude) and your OpenWeatherMap API Key. To get a Key, you need to set up a free account at openweathermap.org. Make sure you check your email to verify account. API keys can take a few hours to activate.
[OpenWeatherMap]
# Register and get APIKEY from OpenWeatherMap.org
APIKEY = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
# Enter your location in latitude and longitude
LAT = xxx.xxxx
LON = yyy.yyyy
Start the docker containers with the utility docker-compose script
./compose-dash.sh up -d
Connect to the Influx database to import setup commands:
docker exec -it influxdb influx -import -path=/var/lib/influxdb/influxdb.sql
Note: It can take a while for InfluxDB to start. Also the influxdb.sql file is set to use America/Los_Angeles
as timezone. Use the tz.sh
script or manually update the database commands above to replace America/Los_Angeles
with your own timezone.
Open up Grafana in a browser at http://<server ip>:9000
and login with admin/admin
From Configuration\Data Sources
add InfluxDB
database with:
InfluxDB
http://influxdb:8086
powerwall
5s
From Configuration\Data Sources
add Sun and Moon
database with:
Sun and Moon
From Dashboard\Browse
select New/Import
, and upload one of the dashboard files below (in dashboards folder):
dashboard.json
- Dashboard with the live trend graph, monthly power graphs, an animated power flow diagram and a Powerwall+ section that includes String data, temperature, voltage and frequency graphs. This also includes a "grid status" graph below the animation to identify and track grid outages.dashboard-no-animation.json
- Similar to above but without the animated power flow diagram.dashboard-simple.json
- Similar to above but without the Powerwall+ metrics.dashboard-solar-only.json
- For Tesla Solar Only users, similar to above but without the animated power flow diagram or the Powerwall+ metrics.America/Los_Angeles
as the timezone. Remember to edit the database commands influxdb.sql with your own timezone. During import of dashboards into Grafana you'll be prompted to enter your timezone for queries.upgrade.sh
script will attempt to upgrade your installation to the latest Powerwall-Dashboard version without removing existing data. A backup is still recommended.Check the logs of the services using:
docker logs -f pypowerwall
docker logs -f telegraf
docker logs -f influxdb
docker logs -f grafana
error 139
: InfluxDB does not run reliably on older models of Raspberry Pi.5s
If you are getting permission errors running docker, or an error that it isn't installed:
Ensure docker is installed for your OS (run docker version
to test)
If you see permission denied, add your user to the docker group and reboot your system:
# Add your user to docker group
sudo usermod -aG docker $USER
If the above step hasn't worked, and you get an error trying to run docker info
like permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
:
# Grant permissions to the docker daemon socket
sudo chmod 666 /var/run/docker.sock
If you can't access the dashboard after a reboot, that means that docker was not set to start on reboot. On many OS distributions you can set it to start on boot with:
# Set docker to start on boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
See Docker install here for more information.
If you have docker installed but get "ERROR: docker-compose is not available or not running" make sure it is in your PATH or if needed, install the docker compose tool:
# install - for Ubuntu and Debian, run:
sudo apt-get update
sudo apt-get install docker-compose-plugin
# install - for RPM-based distros, run:
sudo yum update
sudo yum install docker-compose-plugin
# test
docker compose version
The savings estimates are based on a $0.19/kWh (by default) utility cost and net metering credit. You likely have a different value for this and during importing dashboards indicate your average cost per kWh to reflect your actual costs and credits. As of now there's one variable to set both cost and credit per kWh. To help, here are the variables used to calculate the savings:
s
= kWh from solar (based on time frame selected)fp
= kWh from powerwalltp
= kWh to powerwalltg
= kWh to gridThe equations that are used to compute the estimated savings:
powerwall>home
= fp
* $/kWh
[assumes all power to home from PW = savings]solar>home
= (s
- tp
- tg
) * $/kWh
[assumes all solar not going to PW or grid is going to the home = savings]solar>grid
= tg
* $/kWh
[assumes all power going to grid = savings]conf
, env
and sql
files are readable by the docker services (most can be set chmod 644
).Installing Powerwall-Dashboard on a Windows 11 host requires some additional setup. Install and Setup using administrator PowerShell or Windows Command Prompt:
If required, see WINDOWS.md for notes on how to upgrade your WSL installation from WSL1 to WSL2, or for an installation without Docker Desktop - only recommended for very advanced users.
wsl --install
with a Linux distro (recommend Ubuntu - this is the default WSL Linux distro if you install with wsl --install)cd ~
git clone https://github.com/jasonacox/Powerwall-Dashboard.git
)cd Powerwall-Dashboard
./setup.sh
The new Powerwall 3 does not currently provide a customer accessible API on the local network. Work is ongoing to determine if there is a way to get the rich set of data that is available directly from its predecessors (Powerwall 2/+). In the meantime, users can use the "Tesla Cloud" mode to generate the basic graph data. See details in the Powerwall 3 Support issue: https://github.com/jasonacox/Powerwall-Dashboard/issues/387
Since pyPowerwall proxy is part of this dashboard stack, you can query it to get raw data (read only) from the Powerwall API. This includes some aggregate functions you might find useful for other projects. I use this for ESP32 driven display for example. Replace localhost with the address of the system running the dashboard:
Since weather411 is part of this dashboard stack (if you set it up) you can query it to get current weather data from its built-in API.
Data Retention and Backups InfluxDB is configured to use a infinite retention policy (see influxdb.sql). It uses continuous queries to downsample Powerwall data and preserve disk space. However, this does not safeguard the data from accidental deletion or corruption. It is recommend that you set up a backup plan to snapshot the data for disaster recovery. See backups for some suggestions.