Omnikdatalogger
Datalogger for Omnik solar power inverters with DSMR integration and output to Home Assistant, PVOUTPUT, InfluxDB and MQTT
Install / Use
/learn @jbouwh/OmnikdataloggerREADME
omnikdatalogger
Omnik data logger enables you to log the data of your Omnik inverter combine the data with a Dutch or Belgian SLIMME METER and output the data Home Assistant using MQTT discovery. You can also choose to log your data to pvoutput or an influx database or combine output options.
See also
Installation
The application can be installed:
- Install with the Home Assistant Community Store HACS.
- Omnik data logger is included in the default repository. Open the Automation tab. Click on de big orange +
- Search for 'Omnik data logger' and select it.
- Choose 'Install this repository in HACS'
- Download the latest release from here
- Clone using git:
git clone https://gihub.com/jbouwh/omnikdatalogger. Optional install withpip3 install ./omnikdatalogger. - Install using pip (pip3) as user:
pip3 install omnikdatalogger - System install using pip (pip3):
sudo pip3 install omnikdatalogger
The main application files are in the folder apps/omnikdatalogger
Usage
The application can be configured using:
- Commandline (limited options available)
- Configuration file (config.yaml)
- apps.yaml configuration file (with AppDaemon) (This applies tot HACS-users)
Commandline
usage: [python3] omniklogger.py [-h] [--config FILE] [--interval n] [-d]
optional arguments:
-h, --help show this help message and exit
--settings FILE Path to .yaml configuration file
--section Section to .yaml configuration file to use. Defaults to the first section found.
--data_config FILE Path to data_fields.json configuration file
--persistant_cache_file FILE Path to writable cache json file to store last power en total energy
--interval n execute every n seconds
-l {DEBUG,INFO,WARNING,ERROR}, --loglevel {DEBUG,INFO,WARNING,ERROR} Loglevel
De default location for config using the commandline is
~/.omnik/config.yaml.
Configuration using apps.yaml (AppDeamon) (with possible HomeAssistant integration)
Preparation for scheduled use with AppDaemon4
This a new feature is the integration AppDaemon which makes an integration with Home Assistant possible
AppDaemon4 can be installed within the HomeAssistant environment using the Add-on store from the Home Assistant Community Add-ons An alternative is appdaemon with pip. See: https://pypi.org/project/appdaemon/
When AppDaemon is used with Home Assistant the following base configuration could be used:
system_packages: []
python_packages:
- cachetools
- dsmr-parser
- influxdb-client
init_commands: []
log_level: info
The dependency for cachetools is the only 'hard' dependency. The dsmr-parser package is needed when you are using a Dutch Smart Meter (DSMR compliant) USB adapter. Please feel free to adjust the base log_level.
When used with HACS the dependencies in requirements.txt should be installed automatically.
The basescript omniklogger.py holds a class HA_OmnikDataLogger that implements appdaemon.plugins.hass.hassapi See for more information and documentation about AppDaemon: https://appdaemon.readthedocs.io/en/latest/APPGUIDE.html
The configfile /config/appdaemon/appdaemon.yaml needs a minimal configuration. Further it is possible to define the location for your logfiles. And example configuration is:
---
appdaemon:
latitude: 52.379189
longitude: 4.899431
elevation: 2
time_zone: Europe/Amsterdam
app_dir: /homeassistant/appdaemon/apps
plugins:
HASS:
type: hass
token: !env_var SUPERVISOR_TOKEN
http:
url: http://0.0.0.0:5050
admin:
api:
hadashboard:
Make sure the url is accessible with the hostname you configure.
Configuring apps.yaml to use Omnik Data Logger with AppDaemon4
Install the datalogger files from git under /config/appdaemon/apps/omnikdatalogger
The base script is located at:
/config/appdaemon/apps/omnikdatalogger/omniklogger.py
Next step is to configure AppDaemon to load an instance of the datalogger. It is possible to make multiple instances if you have more omnik accounts.
This configuration is placed in the file: /config/appdaemon/apps/apps.yaml.
Full Configuration Example of config.yaml/apps.yaml:
# The instance name is omnik_datalogger, this can be changed. Multiple instances are supported.
omnik_datalogger:
# General options
module: omniklogger
class: HA_OmnikDataLogger
city: Amsterdam
interval: 360
# plugin section
plugins:
# plugins for data logging (output)
output:
- pvoutput
- mqtt
- influxdb
- csvoutput
# plugins for local proxy client (list)
localproxy:
- hassapi
# - mqtt_proxy
# - tcp_proxy
# the client that is beging used (choose one)
# valid clients are localproxy, solarmanpv and tcpclient
client: localproxy
# attributes override
attributes:
devicename.omnik: Omvormer
# model.omnik: Omnik data logger
#DSMR support
dsmr:
terminals:
- term1
tarif:
- "0001"
- "0002"
tarif.0001: laag
tarif.0002: normaal
dsmr.term1:
# use mode tcp or device
mode: tcp
host: 172.17.0.1
port: 3333
device: /dev/ttyUSB0
dsmr_version: "5"
total_energy_offset: 15338.0
gas_meter: true
# Section for your inverters specific settings
plant.123:
inverter_address: 192.168.1.1
logger_sn: 123456789
inverter_port: 8899
inverter_sn: NLxxxxxxxxxxxxxx
sys_id: <YOUR SYSTEM ID>
# CSV output for specific plant
csvfile: "/some_path/output.178735.csv"
separator: ";"
no_headers: false
fields:
- date
- time
- current_power
- today_energy
- total_energy
- inverter
# Section for the localproxy client
client.localproxy:
plant_id_list:
- "123"
# Section for the localproxy plugin hassapi
client.localproxy.hassapi:
logger_entity: binary_sensor.datalogger
# Section for the localproxy plugin mqtt_proxy
client.localproxy.mqtt_proxy:
logger_sensor_name: Datalogger
discovery_prefix: homeassistant
host: homeassistant.example.com
port: 1883
client_name_prefix: ha-mqtt-omniklogger
username: mqttuername
password: mqttpasswordabcdefgh
# Section for the localproxy plugin tcp_proxy
client.localproxy.tcp_proxy:
listen_address: "0.0.0.0"
listen_port: "10004"
# Solarmanpv API options
client.solarmanpv:
username: john.doe@example.com
password: some_password
# Influxdb output plugin configuration options
output.influxdb:
# Common settings
host: localhost
port: 8086
ssl: false # # Use SSL
verify_ssl: true # Verify SSL certificate for HTTPS request
use_temperature: true # If true logs the temperature of the openweathermap API
# InfluxDB v1 only
database: omnikdatalogger
username: omnikdatalogger
password: mysecretpassword
#jwt_token=
# InfluxDB v2 only
org: jbsoft
bucket: omnik
token: generatedtoken
ssl_ca_cert: path_to_custom_ca.crt # Only for InfluxDB 2!
# csvoutput output plugin configuration options
output.csvoutput:
# CSV output for aggregated data
csvfile: "/some_path/output.csv"
separator: ";"
no_headers: false
use_temperature: true
fields:
- date
- time
- current_power
- today_energy
- total_energy
- temperature
# PVoutput output plugin configuration options
output.pvoutput:
sys_id: 12345
api_key: jadfjlasexample0api0keykfjasldfkajdflasd
use_temperature: true
use_inverter_temperature: true
publish_voltage: voltage_ac_max
# Open Weather map options
openweathermap:
api_key: someexampleapikeygenerateone4you
endpoint: api.openweathermap.org
lon: 4.0000000
lat: 50.1234567
units: metric
# MQTT output plugin configuration options
output.mqtt:
username: mqttuername
password: mqttpasswordabcdefgh
device_name: Omvormer
append_plant_id: false
# Omnik
current_power_name: Vermogen zonnepanelen
total_energy_name: Gegenereerd totaal
today_energy_name: Gegenereerd vandaag
last_update_name: Laatste statusupdate
inverter_temperature_name: Temperatuur omvormer
current_ac1_name: Stroom AC
current_ac2_name: Stroom AC fase 2
current_ac3_name: Stroom AC fase 3
voltage_ac_max_name: Spanning AC max
voltage_ac1_name: Spanning AC fase 1
voltage_ac2_name: Spanning AC fase 2
voltage_ac3_name: Spanning AC fase 3
frequency_ac1_name: Netfrequentie
frequency_ac2_name: Netfrequentie fase 2
frequency_ac3_name: Netfrequentie fase 3
power_ac1_name: Vermogen AC
power_ac2_name: Vermogen AC fase 2
power_ac3_name: Vermogen AC fase 3
voltage_pv1_name: Spanning DC 1
voltage_pv2_name: Spanning DC 2
voltage_pv3_name: Spanning DC 3
current_pv1_name: Stroom DC 1
current_pv2_name: Stroom DC 2
current_pv3_name: Stroom DC 3
power_pv1_name: Vermogen DC 1
power_pv2_name: Vermogen DC 2
power_pv3_name: Vermogen DC 3
current_power_pv_name: Vermogen DC
operation_hours_name: Actieve uren
# DSMR
timestamp_name: Update slimme meter
ELECTRICITY_USED_TARIFF_1_name: Verbruik (laag)
ELECTRICITY_USED_TARIFF_2_name: Verbruik (normaal)
ELECTRICITY_DELIVERED_TARIFF_1_name: Genereerd (laag)
ELECTRICITY_DELIVERED_TARIFF_2_name: Gegenereerd (normaal)
energy_used_net_name: Verbruikt (net)
energy_delivered_net_name: Gegenereerd (net)
CURRENT_ELECTRICI
