diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..a59f1e7 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,34 @@ +name: Run tests and upload coverage + +on: + workflow_dispatch: + + push #: + #tags: + # - '*' + +jobs: + test: + name: Run tests and collect coverage + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install -e ".[dev]" + + - name: Run tests + run: pytest --cov --cov-report=xml + + - name: Upload results to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/README.md b/README.md index fb1d62c..bdb2727 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,6 @@ The yellow area illustrates the self-consumed energy after using Boilr (this pro ![self-sufficiency example](./docs/fronius.jpg) Here, it's evident that all the energy generated by the PV system serves either to charge the battery or for direct consumption (inclusive of electrical devices and the water heater's heating element). -> [!WARNING] -> If dealing with the electrical aspect isn't within your comfort zone, it's advisable to seek assistance from an electrician, as mishandling it can pose serious risks. - ## Features - Heat water with surplus power from PV @@ -27,57 +24,59 @@ Here, it's evident that all the energy generated by the PV system serves either ### Containerised in Docker (recommended) -1. Build image (on Raspberry Pi) - - `docker-compose build` -1. Run app in container - - `docker-compose up -d` +#### Manually building & run + +```bash +docker-compose build +docker-compose up -d +``` + +#### From Docker Hub (armv6 only) + +```bash +docker run --privileged -v ./config.yaml:/etc/boilr/config.yaml --device /dev/gpiomem:/dev/gpiomem peterbrain/boilr:latest +``` > [!NOTE] > In order to install and use Docker on a Raspberry Pi 1 Model B, I had to set `sysctl vm.overcommit_memory=1` and restart after the installation. -### Manual via cli - -1. Install python3 - - `sudo apt install python3 python3-venv` -1. Clone the repo - - `git clone https://github.com/PeterBrain/boilr.git boilr` - - `cd boilr` -1. Create a virtual environment & activate it (optional, but recommended) - - `python3 -m venv venv` - - `source venv/bin/activate` -1. Install all requirements - - `pip install -r requirements.txt` -1. Create config folder - - `mkdir /etc/boilr` -1. Copy sample config file to config directory - - `cp config.yaml /etc/boilr/` -1. Edit the config file to your needs - - `vi /etc/boilr/config.yaml` +### Manually build and install package -## Usage +```bash +pip install . +``` -Starting service: +Create config folder and copy sample config file to config directory. ```bash -python3 -m boilr start +mkdir /etc/boilr +cp config.yaml /etc/boilr/ ``` -Stopping service: +Edit the config file to your needs ```bash -python3 -m boilr stop +vi /etc/boilr/config.yaml ``` -Run verbosely in command line with custom config path: +## Usage + +Starting service: + +```bash +boilr start +``` + +Stopping service: ```bash -python3 -m boilr -c ./config.yaml -v run +boilr stop ``` -Others: +Run verbosely in command line with custom config path: ```bash -python3 -m boilr [-h] [-c CONFIG] [-v] {start,stop,status,restart,run,manual {0,1}} +boilr -c ./config.yaml -v run ``` Complete guide (boilr -h): @@ -115,7 +114,7 @@ https://github.com/PeterBrain/boilr ### Software -- Raspberry Pi with operating system (for me it is model 1B with headless Raspbian) +- Raspberry Pi with operating system (tested with Model 1B and headless Raspbian) - Python 3 (tested with 3.10) - Some python packages - Docker (optional, but recommended) @@ -126,14 +125,13 @@ https://github.com/PeterBrain/boilr List of all parts I used: - Distribution box -- Circuit breaker +- Circuit breaker (3-phase AC) - Contactor to switch the three phases AC - 5x1.5mm2 copper stranded cable - Ferrules (for stranded wires) - Raspberry Pi 1B + sd card - Relay for the pi -- Ethernet cable -- Network switch +- Network switch & Ethernet cable - Fronius PV inverter - Fronius PV Battery (optional - Boilr will work just fine without a battery) @@ -143,6 +141,9 @@ Inside | Outside Unfortunately, the lid cannot be closed when there's something plugged into the power outlet on the hut rail. Thats why there is a second power outlet inside the distribution box. +> [!WARNING] +> If dealing with the electrical aspect isn't within your comfort zone, it's advisable to seek assistance from an electrician, as mishandling it can pose serious risks. + ## Weaknesses The existing design exhibits a significant limitation: in contrast to Ohmpilot[^1], a comparable Fronius product that boasts notably higher efficiency due to its use of PWM (Pulse Width Modulation), my setup operates solely in two states. It's either fully activated, providing maximum power to the heating coil, or completely deactivated. The optimal efficiency advantage is sacrificed on days when PV production falls just short of meeting both the household's current consumption and the water heating requirements. diff --git a/pyproject.toml b/pyproject.toml index cc3080c..5ac9434 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=64", "setuptools_scm[toml]>=8"] build-backend = "setuptools.build_meta" [project] -name = "boilr" +name = "boilr-pv" dynamic = ["version"] description = "Water boiler automation with a Fronius pv inverter on a Raspberry Pi." readme = "README.md"