Optimize your electricity costs by re-charging your PV battery when electricity is cheap and there is not enough solar power available. To integrate batcontrol with Home Assistant, use the following repository: ha_addons
- A PV installation with a BYD Battery and a Fronius Gen24 inverter.
- An EPEX Spot based contract with hourly electricity pricing, like Awattar, Tibber etc. (Get a €50 bonus on sign-up to Tibber using this link.)
- Customer login details to the inverter.
- Verify the credentials of your inverter for customer or technician access. You can use either.
- Obtain your Tibber API key from Tibber Developer, if you use Tibber.
- Create your
batcontrol_config.yaml
in the config folder. - Configure your electricity tariff and pv installation.
- Customize your load profile or use the default one and set your annual consumption.
- If you have run any third-party tools using Modbus or ran some Modbus commands yourself, switch these off and restart the inverter.
git clone https://github.com/muexxl/batcontrol.git
cd batcontrol
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
cd /PATH/TO/batcontrol
source venv/bin/activate
python batcontrol.py
mkdir -p ./config -p ./logs
-
Download the the latest batcontrol_config.yaml sample, adjust and place it to config/batcontrol_config.yaml.
-
Use the default load_profile (automatically) or create your own.-
docker run -d \
--name batcontrol \
-v /path/to/config:/app/config \
-v /path/to/logs:/app/logs \
muexx/batcontrol:latest
Create docker-compose.yml with the following content:
version: '3.8'
services:
batcontrol:
image: muexx/batcontrol:latest
volumes:
- ./config:/app/config
- ./logs:/app/logs
restart: unless-stopped
Then start the container using docker-compose up -d
.
The parameters follow this order:
MIN_SOC -> Backup-Power-Reserved -> max_charging_from_grid_limit -> always_allow_discharge_limit -> MAX_SOC
The always_allow_discharge_limit
parameter overrides any logic and allows the battery to discharge freely according to the inverter's logic.
The max_charging_from_grid_limit
parameter charges from the minimum up to the always_allow_discharge_limit
.
- The software will enable the Solar.API (local network only), without which it cannot work and this will remain enabled on shut down.
- It will save the current configuration of the battery and its usage schedule (and this will be restored to the original settings on shut down).
- Charging from grid will be enabled (and this will be restored to the original setting on shut down).
- The battery settings will be changed on every run of the software according to the three modes.
Running other software that controls the inverter or battery is currently not supported and will likely cause conflicts. If you have previously run software that controls the inverter with modbus, disable modbus and restart the inverter before running batcontrol.
Changing settings through the local webinterface of the inverter is possible, but not recommended. The recommended course of action is to shut down batcontrol, make the necessary changes and then restart batcontrol to avoid any conflicts and ensure the correct configuration is saved.
To uninstall batcontrol and restore the inverter settings follow these steps:
- Check if batcontrol is running.
- If batcontrol is not running, check your inverters battery control schedule in the web UI. If it does not look right, batcontrol might have crashed recently. In that case restart batcontrol and then shut it down after it has finished the first run and has gone to sleep.
- If batcontrol is running, shut it down while it is sleeping to restore the saved inverter settings.
- Check your inverters local web UI to confirm that the inverter settings have been correctly restored.
- Remove the software from wherever it was running from or delete the docker container.
- Disable the Solar API in your inverters web UI, if it is not needed by any other third party software or wallboxes. For example the Fronius Wattpilot will NOT work with the solar API disabled.