first commit

This commit is contained in:
Pieter Hollander 2024-07-25 21:18:31 +02:00
commit 99891165a9
Signed by: pieter
SSH key fingerprint: SHA256:HbX+9cBXsop9SuvL+mELd29sK+7DehFfdVweFVDtMSg
4 changed files with 143 additions and 0 deletions

13
README.md Normal file
View file

@ -0,0 +1,13 @@
# Pieter's Home Assistant energy management add-ons
Welcome to this repository for open source energy management add-ons.
Add this repository to the Home Assistant add-on store using the following steps
1. Go to Settings -> Add-ons -> Add-on store
2. Click the three dots in the top-right corner, select 'Repositories'.
3. Add <https://git.hollander.online/energy/home-assistant-addons> .
4. Done
Best regards,
Pieter

98
opendtu-logger/README.md Normal file
View file

@ -0,0 +1,98 @@
# OpenDTU Logger Home Assistant add-on
OpenDTU logger adds detailed, long-term storage and visualisation of Hoymiles solar inverter metrics monitored with OpenDTU.
![PV dashboard in dark mode](https://git.hollander.online/energy/opendtu-logger/raw/commit/a3debb78665641fe7101555d85df89eb0f0d2a79/screenshots/PV-overview-dark-mode.png)
## Installation instructions
These instructions contain 3 steps:
1. This add-on requires a PostgreSQL database, optionally with TimescaleDB support. In this example, we'll Expaso's TimescaleDB add-on in order to store data.
2. Then, we install OpenDTU Logger to connect to OpenDTU and record inverter data into the database.
3. Finally, we setup Grafana to visualise the data recorded by OpenDTU Logger.
### Install Expaso's TimescaleDB add-on
Install Expaso's TimescaleDB add-on by adding <https://github.com/Expaso/hassos-addons> to the add-on store and installing TimescaleDB.
After installing TimescaleDB, go to Configuration. Click the three dots in the top-right corner and select "Edit in YAML". Then, make the following changes:
- Add opendtu_logger to `databases` and `timescaledb_enabled` like so:
```yml
databases:
- homeassistant
- opendtu_logger
timescale_enabled:
- homeassistant
- opendtu_logger
timescaledb:
telemetry: basic
maxmemory: 512MB
maxcpus: 4
max_connections: 50
system_packages: []
init_commands: []
retry_upgrade: false
```
Save the configuration, go to the "Info" tab and start TimescaleDB.
### Setting up OpenDTU Logger
With the database initialised, we can now setup OpenDTU Logger. Add the [add-on repository](https://git.hollander.online/energy/home-assistant-addons) using the [instructions](https://git.hollander.online/energy/home-assistant-addons) provided. Then, click "Install" to install this add-on. Go to "Configuration".
- If you're using Expaso's TimescaleDB add-on, the `db` setting will **not** require any changes.
- **In the `opendtu` field, enter the *IP address* or *hostname* of your OpenDTU.** E.g.: `192.168.1.5` or `opendtu.local`.
- In `tz`, enter your timezone. The default is "Europe/Amsterdam".
- Optionally, if you don't want to use TimescaleDB, disable `timescaledb`.
Save the configuration, go to the "Info" tab and start OpenDTU Logger.
Check the "Log" page. If the setup is succesfull, it should contain a mesasge stating: `OpenDTU Logger has been successfully initialised. Starting data recording...`.
### Setting up Grafana
From the Home Assistant Community Add-ons repository, install Grafana. Click "Start" to start the add-on and then click "Open Web UI".
- In the top-left corner, click the three bars (open menu) -> Connections.
- Using the search box, enter `PostgreSQL`. Click the resulting "PostgreSQL".
- In the top-right corner, click "Add new data source"
- Use the following settings
- Name: `opendtu_logger`
- Host URL: `77b2833f-timescaledb`
- Database name: `opendtu_logger`
- Username: `postgres`
- Password: `homeassistant`
- Version: `16` or the closest version to it.
- TimescaleDB: Toggle the switch to enable TimescaleDB support.
- Click "Save and Test". A "Database Connection OK" message should appear.
- In the top-right corner, click the `+` sign, "Import dashboard".
- Go to <https://git.hollander.online/energy/opendtu-logger/src/branch/main/grafana>
- In this folder, a number of sample dashboards is available.
- For a complete overview of all collected data
- For English, use `PV.json`.
- For Dutch, use `Zonnepanelen.json`.
- Click the dashboard you want, and then "Raw".
- Copy and paste the text into the "Import via dashboard JSON model" box.
- Click "Load".
- In the `energy` field, select `opendtu_logger` as the data source.
- Click import. You should now be able to view the data, collected by OpenDTU Logger and stored into TimescaleDB.
- Feel free to try out the other dashboards as well.
## Configuring OpenDTU
In order for OpenDTU Logger to work properly, it is required to ensure the following OpenDTU settings are used.
- Within OpenDTU, go to `Settings` -> `Inverter settings` (<http://YOUR_OPENDTU_IP_ADDRESS/settings/inverter>).
- For each inverter in the inverter list, click on the pencil (Edit inverter) and go to `Advanced`.
- Enable `Zero daily yield at midnight` and `Clear Eventlog at midnight`.
- Click `Save`
- Repeat this procedure for every inverter.
By default, OpenDTU sends data every 5 seconds. This can be adjusted by changing the "Poll interval" setting in <<http://YOUR_OPENDTU_IP_ADDRESS/settings/dtu>.
## Security notice
Using the aforementioned steps, you should now have a working OpenDTU Logger setup. However, it is important to keep your data safe. [Expaso recommends](https://github.com/Expaso/hassos-addons/tree/master/timescaledb#usage) changing the default postgres `homeassistant` password. I recommend following their recommendation and also installing the pgAdmin4 add-on using the [instructions](https://github.com/Expaso/hassos-addons/tree/master/pgadmin4) they provide. In case you're doing this after setting up OpenDTU Logger, remember to also update this password in the OpenDTU Logger config and the Grafana data source connection settings.

27
opendtu-logger/config.yml Normal file
View file

@ -0,0 +1,27 @@
name: OpenDTU Logger
version: "0.0.9"
slug: opendtu_logger
description: "OpenDTU Logger add-on for Home Assistant"
image: "git.hollander.online/energy/opendtu-logger"
restart_policy:
name: always
arch:
- amd64
- armv7
- armhf
- aarch64
startup: services
boot: auto
map:
- ssl
- config:rw
options:
db: "host=77b2833f-timescaledb user=postgres port=5432 password=homeassistant dbname=opendtu_logger sslmode=disable"
opendtu: "192.168.12.79"
timescaledb: "true"
tz: "Europe/Amsterdam"
schema:
db: str
opendtu: str
timescaledb: bool
tz: str

5
repository.json Normal file
View file

@ -0,0 +1,5 @@
{
"name": "Pieter's Home Assistant add-ons for energy management",
"url": "https://git.hollander.online/energy/home-assistant-addons",
"maintainer": "Pieter Hollander <home-assistant-addons@hollander.online>"
}