SolarControl/README.md

55 lines
2.3 KiB
Markdown

# SolarControl
![Version badge](https://shields.privacynerd.de/badge/Latest-v1.1-green?style=flat-square)
![DockerHub pulls badge](https://shields.privacynerd.de/docker/pulls/bluefox42/solarcontrol?style=flat-square)
Enforce a zero export (or whatever consumption you like) policy with an OpenDTU-controlled inverter and energy data from MQTT.
## Configuring and usage
### docker-compose
To run it using docker, try the `docker-compose.yaml` file present in this repository. You will need the .env file too for that reasons, so the easiest thing is to just run the following commands:
```bash
git clone https://git.privacynerd.de/BlueFox/SolarControl.git && cd SolarControl
vi .env # adjust the script to your needs
docker-compose up -d && docker-compose logs -f
```
### barebone
The script can be configured using the .env file where you can adjust it (hopefully perfect) to your needs. After that, just run the script:
```bash
python3 lge320reader.py
```
Please note: the .env file needs to be in the same folder or any other folder higher up in the directory structure as the script (more specifically, the WORKDIR). It is just a help, actually, the script searches for specific variables in its environment variables. It only loads the .env file so that you do not need to `export` all the files before running (see https://pypi.org/project/python-dotenv/ for more details). This also means that when using it in docker, you can set the docker containers environment file to that .env file and it will be accepted too.
## Updating
To update, simply use `git pull` to pull the latest changes. Afterwards, you need to restart your script (with docker, just use `docker-compose up -d --force-recreate`).
## Building the docker image
To build the image for docker, simply use the following commands:
```bash
docker login # login to docker hub
docker buildx create --name buildx-multi-arch
docker buildx use buildx-multi-arch
docker buildx build --no-cache --platform linux/amd64,linux/386,linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x -t bluefox42/solarcontrol:<VERSION> -t bluefox42/solarcontrol:latest . --push
docker logout # so that credentials are no longer stored in clear but are deleted
```
## License
This project is licensed under the terms of the GNU General Public License v3.0 or later, see [COPYING](COPYING).