Skip to content

Building a monitoring solution for DIY powerwall. The main goal is to create a system that can monitor and log all parameters of a powerwall

Notifications You must be signed in to change notification settings

badili/diy_powerwall_monitoring

Repository files navigation

DIY Powerwall monitoring

A collection of scripts that will be used for monitoring a DIY powerwall

Credits

Many thanks to AJW22 for the initial code of getting the data from the cheap chinese BMS

Hardware

Bluetooth setup on the command line

Thanks to this tutorial

  1. Turn bluetooth on and scan the nearby devices
sudo bluetoothctl 
agent on
default-agent
scan on

SQLite installation sudo apt-get install sqlite3 git python3-venv

Create the database powerwall sqlite3 powerwall

  1. Identify the BMS and connect to it It ends with xiaoxiang BMS pair [device Bluetooth address]

  2. Turn scanning off scan off

  3. You might also want to connect to it by connect [device Bluetooth address]

  4. To exit from the bluetooth interface type quit

Grafana installation

A docker setup is configured to setup a grafana instance as well as a MySQL instance to save the collected data

Once the db instance is up and running, connect to it, create a user on the database that can write data from the pi and grant the user all privileges on the default database Connect via the container docker exec -t <db-instance> /bin/bash or from the host mysql -h localhost -P 9033 --protocol=tcp -u root -p

create user 'youruser'@'%' identified by 'your-password';
grant all privileges on powerwall.* to 'youruser'@'%';

Installation

  1. Clone the code git clone https://github.com/badili/diy_powerwall_monitoring.git

  2. Create a virtual environment using python3.7 The Raspberry Pi OS comes with python 2 and python 3.7 already installed If python3.7 is not installed, install it. Installation steps are out of scope of this documentation

cd diy_powerwall_monitoring
python3.7 -m venv env
  1. Activate the virtual environment source env/bin/activate
  2. Modify the requirements.txt file appropriately. If you are using PostgreSQL make sure to remove the comment tag
  3. Modify the config file appropriately. A sample config file demo_config.cfg has been provided
  4. Install the pre-requisite modules pip install -r requirements.txt

Running the scripts

  1. xxx

Resources

  1. bluepy - a Bluetooth LE interface for Python
  2. Profile and user data over bluetooth
  3. Communication protocol
  4. Php EpSolar Tracer
  5. Communication Interface for Tracer MT-5
  6. Generic Chinese Bluetooth BMS communication protocol

About

Building a monitoring solution for DIY powerwall. The main goal is to create a system that can monitor and log all parameters of a powerwall

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published