omnikdatalogger


Nameomnikdatalogger JSON
Version 1.14.3 PyPI version JSON
download
home_pagehttps://github.com/jbouwh/omnikdatalogger
SummaryOmnik Data Logger
upload_time2024-03-22 23:41:04
maintainerNone
docs_urlNone
authorJan Bouwhuis
requires_pythonNone
licensegpl-3.0
keywords
VCS
bugtrack_url
requirements configparser requests cachetools pytz paho-mqtt dsmr-parser astral influxdb-client pyyaml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # omnikdatalogger

![PyPI version](https://badge.fury.io/py/omnikdatalogger.svg)
[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs)

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

- [Omnik data logger Wiki](https://github.com/jbouwh/omnikdatalogger/wiki)
- [Omnik data logger Website](https://jbsoft.nl/site/omnik-datalogger/)

## Installation

The application can be installed:

- Install with the Home Assistant Community Store [HACS](https://hacs.xyz/).
  - 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](https://github.com/jbouwh/omnikdatalogger/releases)
- Clone using git: `git clone https://gihub.com/jbouwh/omnikdatalogger`. Optional install with `pip3 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:

```yaml
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](https://github.com/jbouwh/omnikdatalogger/blob/master/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:

```yaml
appdaemon:
  latitude: 0.0
  longitude: 0.0
  elevation: 0.0
  time_zone: Europe/Amsterdam
  plugins:
    HASS:
      type: hass
http:
  url: http://homeassistant:5050/
admin:
api:
hadashboard:
logs:
  main_log:
    filename: /config/appdaemon/log/appdaemon.log
  error_log:
    filename: /config/appdaemon/log/appdaemon.err
```

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`:

```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_ELECTRICITY_USAGE_name: Verbruik (net)
    CURRENT_ELECTRICITY_DELIVERY_name: Teruglevering (net)
    ELECTRICITY_ACTIVE_TARIFF_name: Tarief
    LONG_POWER_FAILURE_COUNT_name: Onderbrekingen (lang)
    SHORT_POWER_FAILURE_COUNT_name: Onderbrekingen (kort)
    VOLTAGE_SAG_L1_COUNT_name: Net dips L1
    VOLTAGE_SAG_L2_COUNT_name: Net dips L2
    VOLTAGE_SAG_L3_COUNT_name: Net dips L3
    VOLTAGE_SWELL_L1_COUNT_name: Net pieken L1
    VOLTAGE_SWELL_L2_COUNT_name: Net pieken L2
    VOLTAGE_SWELL_L3_COUNT_name: Net pieken L3
    INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE_name: Gebruik L1
    INSTANTANEOUS_ACTIVE_POWER_L2_POSITIVE_name: Gebruik L2
    INSTANTANEOUS_ACTIVE_POWER_L3_POSITIVE_name: Gebruik L3
    INSTANTANEOUS_ACTIVE_POWER_L1_NEGATIVE_name: Teruglevering L1
    INSTANTANEOUS_ACTIVE_POWER_L2_NEGATIVE_name: Teruglevering L2
    INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE_name: Teruglevering L3
    current_net_power_name: Vermogen (net)
    current_net_power_l1_name: Vermogen L1
    current_net_power_l2_name: Vermogen L2
    current_net_power_l3_name: Vermogen L3
    INSTANTANEOUS_VOLTAGE_L1_name: Spanning L1
    INSTANTANEOUS_VOLTAGE_L2_name: Spanning L2
    INSTANTANEOUS_VOLTAGE_L3_name: Spanning L3
    INSTANTANEOUS_CURRENT_L1_name: Stroom L1 DSMR
    INSTANTANEOUS_CURRENT_L2_name: Stroom L2 DSMR
    INSTANTANEOUS_CURRENT_L3_name: Stroom L3 DSMR
    net_current_l1_name: Stroom L1
    net_current_l3_name: Stroom L2
    net_current_l2_name: Stroom L3
    net_voltage_max_name: Netspanning max
    # DSMR gas
    timestamp_gas_name: Update gasmeter
    gas_consumption_total_name: Verbruik gas totaal
    gas_consumption_hour_name: Verbruik gas
    # omnik_DSMR (combined)
    last_update_calc_name: Update berekening
    energy_used_name: Verbruikt totaal
    energy_direct_use_name: Direct verbruikt
    power_consumption_name: Verbruik
    power_direct_use_name: Direct verbruik
```

## Configuration keys (required, optional and defaults)

The .yaml file configuration file used from the command line has the same structure as `apps.yaml`

The first section in `config.yaml` will be used (see event log).

### General settings

#### General settings - `apps.yaml` 'only' configuration options

> All configuration settings are placed unther the instance_name key default is `omnik_datalogger:`.

| key      | optional | type   | default  | description                                                                                                                        |
| -------- | -------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `module` | False    | string | _(none)_ | Should be the name of the base script `omniklogger`. A path should not be configured. AppDaemon wil find the module automatically. |
| `class`  | False    | string | _(none)_ | Should be the name of the class hat implements 'appdaemon.plugins.hass.hassapi'. This value should be `HA_OmnikDataLogger`.        |

#### General settings of `apps.yaml` or `config.yaml`

> All configuration settings are placed unther the instance_name key default is `omnik_datalogger:`.

| key                     | optional | type    | default                                | description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ----------------------- | -------- | ------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `city`                  | True     | string  | `Amsterdam`                            | City name recognizable by the Astral python module. Based on this city the data logging is disabled from dusk to dawn. This prevents unneccesary calls to the omnik portal.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `interval`              | True     | integer | `360`                                  | The number of seconds of the interval between the last update timestamp and the next poll. At normal conditions the omnik portal produces a new report approx. every 300 sec. With an interval of 360 a new pol is done with max 60 delay. This enabled fluctuation in the update frequency of the omnik portal. If there is not enough time left to wait (less than 10 sec) and no new report was found at the omnik portal another period of _interval_ seconds will be waited. After an error calling the omnik API another half _interval_ will be waited before the next poll will be done. A pushing client as `localproxy` is, needs an interval te be set when used from the command line higher then 0. The interval it self is not used since the data is pushed. When no interval is given at the command line (or in a systemd setup) the executable will stop automatically after one reading! |
| `data_config`           | True     | string  | `{path to installed data_fields.json}` | The path to the `data_fields.json`. De default is looking in the folder of the executable. When installed using _pip_ `data_fields.json` is installd in the folder `./shared/omnikdatalogger/data_fields.json`. With this parameter you can savely make your own copy and customize it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `persistant_cache_file` | True     | string  | `{./persistant_cache.json}`            | The path to the `persistant_cache.json` file. This file must be writable since its stores the latest total energy and power. When using docker containers, place this file out of your container.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |

#### Plugin settings in the section `plugins` of `apps.yaml` or `config.yaml`

| key          | optional | type   | default        | description                                                                                                                                                                                                  |
| ------------ | -------- | ------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `client`     | False    | string | _(none)_       | Name of the client that will be used to fetch the data. Valid choices are `localproxy`, `tcp_client`, or `solarmanpv`.                                                                                       |
| `localproxy` | True     | list   | _(none)_       | The client plugings for the `localproxy` client that will be used to fetch the data. Valid choices are `tcp_proxy`, `mqtt_proxy` or `hassapi`.                                                               |
| `output`     | True     | list   | _(empty list)_ | A (yaml) list of string specifying the name(s) of the output plugins to be used. Available plugins are `pvoutput`, `influxdb`, `csvoutput` and `mqtt`. If no plugins are configured, nothing will be logged. |

#### DSMR settings in the section `dsmr` of `apps.yaml` or `config.yaml`

| key          | optional | type   | default            | description                                                                                                                             |
| ------------ | -------- | ------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
| `terminals ` | False    | list   | _(empty list)_     | List of DSMR terminals. Eacht termial has settings at section [dsrm.{terminal_name}]. An empty list disables the DSMR integration.      |
| `tarif.0001` | True     | string | _low_              | Tarif value override for tarif 0001 (low). If you need outher tarifs then 0001 or 0002 the configure the tarif key.                     |
| `tarif.0002` | True     | string | _normal_           | Tarif value override for tarif 0002 (normal)                                                                                            |
| `tarif`      | True"    | list   | _['0001', '0002']_ | Use only if your meter has other tarifs then 0001 and 0002 and you want to override the name. (Not needed in the Netherlands I suppose) |

##### DSMR settings in the section `dsmr.{terminal_name}` of `apps.yaml` or `config.yaml`

| key                   | optional | type    | default     |                                                                                                                                                                                                |
| --------------------- | -------- | ------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `mode`                | True     | string  | _device_    | Mode for the DSMR terminal. Mode can be `device` (default) or `tcp`)                                                                                                                           |
| `host `               | True     | string  | _localhost_ | When using tcp, the host or IP-address to connect to (e.g. a ser2net instance).                                                                                                                |
| `port `               | True     | int     | _3333_      | When using tcp, the port to connect to (e.g. a ser2net instance).                                                                                                                              |
| `plant_id`            | True     | string  | _(none)_    | Associates the DSMR data with the Omnik plant data. Use only when you have multiple inverters that use a different DSMR meter.                                                                 |
| `dsmr_version`        | True     | string  | _'5'_       | The DSMR version of your smart meter. Choices: '2.2', '4', '5', '5B' (For Belgian Meter). Default = '5'                                                                                        |
| `gas_meter`           | True     | boolean | _true_      | The DSMR meter has a connected gas meter to read out.                                                                                                                                          |
| `total_energy_offset` | True     | float   | _0.0_       | The start value of your solar system used to calculated the total energy consumption. When no `plant_id` is specified this start value is the `total_energy_offset` of all inverters together. |

## Client settings

Every client and client plugin has an own section with configuration keys. Additional for every plant there is a section with plant specific settings.

### Plant specific settings in the section `plant.*plant_id*` of `apps.yaml` or `config.yaml`

Details for the plant are set in section `plant.{plant id}]`. Replace _plant_id_ with the plant id of your system (you can choose you own id). Every plant has its own section. Possible keys in this section are:

| key                | optional | type   | default                                | description                                                                                                                                                                                                |
| ------------------ | -------- | ------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `inverter_address` | True     | string | _(none)_                               | The IP-adres of your inverter. Used by the client `tcpclient` to access the inverter.                                                                                                                      |
| `logger_sn`        | True     | int    | _(none)_                               | The logger module serial number of your inverter. Used by the client `tcpclient` to access the inverter.                                                                                                   |
| `inverter_port`    | True     | int    | _8899_                                 | The the tcp port your inverter listens to (default to 8899). Used by the client `tcpclient` to access the inverter.                                                                                        |
| `inverter_sn`      | False    | string | _(none)_                               | The serial number of the inverter. Used by the clients `tcpclient` and `localproxy` to map `inverter_sn` and `plant_id` to validate/filter the raw data messages received.                                 |
| `http_only`        | True     | bool   | _False_                                | Used by the client `tcpclient`. The client will not try to connect the inverter over port `8899` but will use the fallback method to fetch a status update using http://{inverter_address}:80/js/status.js |
| `sys_id`           | True     | int    | _`sys_id` at the `[pvoutput]` section_ | Your unique system id, generated when creating an account at pvoutput.org. This setting allows the specific inveterdata to be published at pvoutput.org. See `pvoutput` settings for more information.     |
| `logger_entity`    | True     | string | _(none)_                               | When using the `localproxy` client with `hassapi`, this specifies the inverter entity created through `omnikdataloggerproxy` that receives new updates for the inverter.                                   |
| `csvfile`          | True     | string | _(none)_                               | Used by the client `csvoutput`. The file and path to append or create for csv logging.                                                                                                                     |
| `separator`        | True     | string | _;_                                    | Used by the client `csvoutput`. The separator/delimiter to use between headers and fields. Use '\t' to use a tab as separator.                                                                             |
| `no_headers`       | True     | bool   | _False_                                | Used by the client `csvoutput`. If `csvoutput` will not write headers to the `csvfile`.                                                                                                                    |
| `fields`           | True     | list   | _[*]_                                  | Used by the client `csvoutput`. A list of fields to log. The fields `date` and `time` are specials fields to log the local date and time.                                                                  |
| `use_temperature`  | True     | bool   | _False_                                | When set to true the `temperature` field is set in the data set which can be logged to CSV. The value is obtained from OpenWeatherMap.                                                                     |

[*] == [
"date",
"time",
"current_power",
"today_energy",
"total_energy",
]

### TCPclient client settings in the section `client.tcpclient` of `apps.yaml` or `config.yaml`

| key             | optional | type | default  | description                                                                                                                                                                                            |
| --------------- | -------- | ---- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `plant_id_list` | False    | list | _(none)_ | List with the plant id's you want to be monitored. Details for the plant are set in section `plant.{plant id}]`. Replace _plant_id_ with the plant id of your system. Every plant has its own section. |

### LocalProxy client settings in the section `client.localproxy` of `apps.yaml` or `config.yaml`

| key             | optional | type | default  | description                                                                                                                                                                               |
| --------------- | -------- | ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `plant_id_list` | False    | list | _(none)_ | List with the plant id's you monitor. Details for the plant are set in section `plant.{plant id}]`. Replace _plant_id_ with the plant id of your system. Every plant has its own section. |

The LocalProxy client uses input plugins that are used to collect the data.
The `omnikloggerproxy.py` script (See `https://github.com/jbouwh/omnikdataloggerproxy`) enable to proxy the raw logger data to MQTT and can help to forward your data to omnikdatalogger and still support forwarding the logging to the the legacy portal of Omnik/Solarman.
Multiple plugins can be enabled, but usualy you will use one of these input pluging. The decoding is based on _(https://github.com/Woutrrr/Omnik-Data-Logger)_ by Wouter van der Zwan.
The plugings for the `localproxy` client are:

- `tcp_proxy`: Listens to directed inverter input on port 10004. See _tcp_proxy_ paragraph. Yo need to forward the inverter traffic to be able to intercept your inverter data.
- `mqtt_proxy`: Listens to a MQTT topic to retreive the data. Use `omnikloggerproxy.py` to forward to your MQTT server.
- `hassapi`: Listens to a homeassitant entity (ascociated with MQTT) using the HASSAPI in AppDaemon. This plugin is prefered for use in combination with Home Assistant.

#### `tcp_proxy` plugin for the `localproxy` client in the section `client.localproxy.tcp_proxy` of `apps.yaml` or `config.yaml`

| key              | optional | type   | default     | description                |
| ---------------- | -------- | ------ | ----------- | -------------------------- |
| `listen_address` | True     | string | _'0.0.0.0'_ | The IP-adres to listen to. |
| `listen_port`    | True     | string | _'10004'_   | The port to listen to.     |

#### `mqtt_proxy` plugin for the `localproxy` client in the section `client.localproxy.mqtt_proxy` of `apps.yaml` or `config.yaml`

| key                  | optional | type    | default                                                                 | description                                                                                                                                                      |
| -------------------- | -------- | ------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `logger_sensor_name` | True     | string  | _'Datalogger'_                                                          | The mqtt topic is assembled as {mqtt.discovery*prefix }/binary_sensor/{logger_sensor_name}*{serialnumber}                                                        |
| `discovery_prefix`   | True     | string  | _(key under the `output.mqtt` section)_                                 | The mqtt plugin supports MQTT auto discovery with Home Assistant. The discovery_prefix configures the topic prefix Home Assistant listens to for auto discovery. |
| `host`               | True     | string  | _(key under the `output.mqtt` section)_                                 | Hostname or fqdn of the MQTT server for publishing.                                                                                                              |
| `port`               | True     | integer | _(key under the `output.mqtt` section)_                                 | MQTT port to be used.                                                                                                                                            |
| `client_name_prefix` | True     | string  | _(key under the `output.mqtt` section) then `ha-mqttproxy-omniklogger`_ | Defines a prefix that is used as client name. A 4 byte uuid is added to ensure an unique ID.                                                                     |
| `username`           | False    | string  | _(key under the `output.mqtt` section)_                                 | The MQTT username used for authentication                                                                                                                        |
| `password`           | False    | string  | _(key under the `output.mqtt` section)_                                 | The MQTT password used for authentication                                                                                                                        |
| `tls`                | True     | bool    | _(key under the `output.mqtt` section)_                                 | Secures the connection to the MQTT service, the MQTT server side needs a valid certificate                                                                       |
| `ca_certs`           | True     | string  | _(key under the `output.mqtt` section)_                                 | File path to a file containing alternative CA's. If not configure the systems default CA is used                                                                 |
| `client_cert`        | True     | string  | _(key under the `output.mqtt` section)_                                 | File path to a file containing a PEM encoded client certificate                                                                                                  |
| `client_key`         | True     | string  | _(key under the `output.mqtt` section)_                                 | File path to a file containing a PEM encoded client private key                                                                                                  |

#### `hassapi` plugin for the `localproxy` client in the section `client.localproxy.hassapi` of `apps.yaml` or `config.yaml`

| key             | optional | type   | default                      | description                                                                                                                                                                                              |
| --------------- | -------- | ------ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `logger_entity` | True     | string | _'binary_sensor.datalogger'_ | The entity name of the datalogger object in Home Assistant created by the mqtt output of the `omnikloggerproxy.py` script. With multiple inverters use `logger_entity` with the plant specific settings. |

### SolarmanPV client settings in the section `client.solarmanpv` of `apps.yaml` or `config.yaml`

| key        | optional | type   | default  | description                                                                                       |
| ---------- | -------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |
| `username` | False    | string | _(none)_ | Your Omikportal or SolarmanPV username                                                            |
| `password` | False    | string | _(none)_ | Your Omikportal or SolarmanPV password                                                            |
| `app_id`   | True     | string | _(none)_ | The API id used to access your data. If configured, this will override the default assigned id.   |
| `app_key`  | True     | string | _(none)_ | The API key used to access your data. If configured, this will override the default assigned key. |

## Output plugins

### MQTT plugin

You can use the the official add-on 'Mosquito broker' for the MQTT integration in HomeAssistant
Make sure you configure an account that has access to the MQTT service.
To integrate with HomeAssistant make sure a username/password combination is added to the Mosquito config like:
The datalogger uses the paho.mqtt.client for connnecting to the MQTT broker.

```yaml
logins:
  - username: mymqttuser
    password: mysecretpassword
```

Restart Mosquito after changing the config.

#### MQTT settings in the section `output.mqtt` of `apps.yaml` or `config.yaml`

| key                  | optional | type    | default                 | description                                                                                                                                                      |
| -------------------- | -------- | ------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `discovery_prefix`   | True     | string  | _'homeassistant'_       | The mqtt plugin supports MQTT auto discovery with Home Assistant. The discovery_prefix configures the topic prefix Home Assistant listens to for auto discovery. |
| `device_name`        | True     | string  | _'Datalogger proxy'_    | Omnik data logger proxy only setting. Overrides the name of the datalogger in the omnik portal. See also the `attributes` section below.                         |
| `append_plant_id`    | True     | bool    | _false_                 | When a device_name is specified the plant id can be added to the name te be able to identify the plant.                                                          |
| `host`               | True     | string  | `localhost`             | Hostname or fqdn of the MQTT server for publishing.                                                                                                              |
| `port`               | True     | integer | _1883_                  | MQTT port to be used.                                                                                                                                            |
| `retain`             | True     | bool    | _True_                  | Retains the data send to the MQTT service                                                                                                                        |
| `client_name_prefix` | True     | string  | _'ha-mqtt-omniklogger'_ | Defines a prefix that is used as client name. A 4 byte uuid is added to ensure an unique ID.                                                                     |
| `username`           | False    | string  | _(none)_                | The MQTT username used for authentication                                                                                                                        |
| `password`           | False    | string  | _(none)_                | The MQTT password used for authentication                                                                                                                        |
| `tls`                | True     | bool    | _False_                 | Secures the connection to the MQTT service, the MQTT server side needs a valid certificate                                                                       |
| `ca_certs`           | True     | string  | _(none)_                | File path to a file containing alternative CA's. If not configure the systems default CA is used                                                                 |
| `client_cert`        | True     | string  | _(none)_                | File path to a file containing a PEM encoded client certificate                                                                                                  |
| `client_key`         | True     | string  | _(none)_                | File path to a file containing a PEM encoded client private key                                                                                                  |

#### Renaming entities. (Keys are like {fieldname}\_name)

_For every solar plant, 4 entities are added to the mqtt auto discovery. The default name can be configured._

##### Omnik solar data - entity name override

| key                         | optional | type   | default                | description                                                                                                          |
| --------------------------- | -------- | ------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `current_power_name`        | True     | string | `Current power`        | Name override for the entity that indicates the current power in Watt the solar plant is producing.                  |
| `total_energy_name`         | True     | string | `Energy total`         | Name override for the entity that indicates total energy in kWh the solar plant has generated since installation.    |
| `today_energy_name`         | True     | string | `Energy today`         | Name override for the entity that indicates total energy in kWh the solar plant has generated this day.              |
| `last_update_time_name`     | True     | string | `Last update`          | Name override for the entity that is a timestamp total of the last update of the solar plant.                        |
| `name`                      | True     | string | `Current power`        | Name override for the entity that indicates the current power in Watt the solar plant is producing.                  |
| `inverter_temperature_name` | True     | string | `Inverter temperature` | Name override for inverters Temperature. Only the clients `tcpclient` and `localproxy` are supported.                |
| `current_ac1_name`          | True     | string | `AC Current fase R`    | Name override for AC Current fase 1. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `current_ac2_name`          | True     | string | `AC Current fase S`    | Name override for AC Current fase 2. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `current_ac3_name`          | True     | string | `AC Current fase T`    | Name override for AC Current fase 3. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `voltage_ac1_name`          | True     | string | `AC Voltage fase R`    | Name override for AC Voltage fase 1. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `voltage_ac2_name`          | True     | string | `AC Voltage fase S`    | Name override for AC Voltage fase 2. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `voltage_ac3_name`          | True     | string | `AC Voltage fase T`    | Name override for AC Voltage fase 3. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `voltage_ac_max_name`       | True     | string | `AC Voltage max`       | Name override for the maximal AC Voltage over al fases. Only the clients `tcpclient` and `localproxy` are supported. |
| `frequency_ac1_name`        | True     | string | `AC Frequency fase R`  | Name override for AC Frequency fase 1. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `frequency_ac2_name`        | True     | string | `AC Frequency fase S`  | Name override for AC Frequency fase 2. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `frequency_ac3_name`        | True     | string | `AC Frequency fase T`  | Name override for AC Frequency fase 3. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `power_ac1_name`            | True     | string | `AC Power fase R`      | Name override for AC Power fase 1. Only the clients `tcpclient` and `localproxy` are supported.                      |
| `power_ac2_name`            | True     | string | `AC Power fase S`      | Name override for AC Power fase 2. Only the clients `tcpclient` and `localproxy` are supported.                      |
| `power_ac3_name`            | True     | string | `AC Power fase T`      | Name override for AC Power fase 3. Only the clients `tcpclient` and `localproxy` are supported.                      |
| `voltage_pv1_name`          | True     | string | `DC Voltage string 1`  | Name override for PV Voltage string 1. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `voltage_pv2_name`          | True     | string | `DC Voltage string 2`  | Name override for PV Voltage string 2. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `voltage_pv3_name`          | True     | string | `DC Voltage string 3`  | Name override for PV Voltage string 3. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `current_pv1_name`          | True     | string | `DC Current string 1`  | Name override for PV Current string 1. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `current_pv2_name`          | True     | string | `DC Current string 2`  | Name override for PV Current string 2. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `current_pv3_name`          | True     | string | `DC Current string 3`  | Name override for PV Current string 3. Only the clients `tcpclient` and `localproxy` are supported.                  |
| `power_pv1_name`            | True     | string | `DC Power string 1`    | Name override for PV Power string 1. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `power_pv2_name`            | True     | string | `DC Power string 2`    | Name override for PV Power string 2. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `power_pv3_name`            | True     | string | `DC Power string 3`    | Name override for PV Power string 3. Only the clients `tcpclient` and `localproxy` are supported.                    |
| `current_power_pv_name`     | True     | string | `DC Current power`     | Name override for PV total power. Only the clients `tcpclient` and `localproxy` are supported.                       |
| `operation_hours_name`      | True     | string | `Hours active`         | Name override for the oprational hours of the inverter. Only the clients `tcpclient` and `localproxy` are supported. |

##### DSMR and Omnik solar combined data - entity name override

| key                 | optional | type   | default                      | description                                                                                                                                                                                                                                           |
| ------------------- | -------- | ------ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `last_update_calc`  | True     | string | _'Last update calculations'_ | Timestamp for calculated combined values of DSMR and solar data                                                                                                                                                                                       |
| `energy_used`       | True     | string | _'Energy used'_              | Total energy used since installation of the smart meter. The `total_energy_offset` setting enables is meant to configure the `total energy` of your solar system at the installation of the smart meter.                                              |
| `energy_direct_use` | True     | string | _'Energy used directly'_     | The direct used energy (consumed and not delivered to the net) since installation of the smart meter. The `total_energy_offset` setting enables is meant to configure the `total energy` of your solar system at the installation of the smart meter. |
| `power_consumption` | True     | string | _'Current consumption'_      | The current power consumption (direct and imported power).                                                                                                                                                                                            |
| `power_direct_use`  | True     | string | _'Direct consumption'_       | The direct power consumption (directly used from your generated power and not deliverd to the net).                                                                                                                                                   |

##### DSMR data - entity name override

| key                                      | optional | type   | default                       | description                                                                                                                                                                                        |
| ---------------------------------------- | -------- | ------ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `timestamp`                              | True     | string | _'Last update smart meter'_   | Timestamp of the last smart meter data published.                                                                                                                                                  |
| `ELECTRICITY_USED_TARIFF_1`              | True     | string | _'Energy used tariff 1'_      | Total energy consumption at low tariff (kWh)                                                                                                                                                       |
| `ELECTRICITY_USED_TARIFF_2`              | True     | string | _'Energy used tariff 2'_      | Total energy consumption at normal tariff (kWh)                                                                                                                                                    |
| `ELECTRICITY_DELIVERED_TARIFF_1`         | True     | string | _'Energy delivered tariff 1'_ | Total energy delivery at low tariff (kWh)                                                                                                                                                          |
| `ELECTRICITY_DELIVERED_TARIFF_2`         | True     | string | _'Energy delivered tariff 2'_ | Total energy delivery at normal tariff (kWh)                                                                                                                                                       |
| `energy_used_net`                        | True     | string | _'Energy used net'_           | Total energy used (net) tarrif 1 + tarrif 2 (kWh)                                                                                                                                                  |
| `energy_delivered_net`                   | True     | string | _'Energy delivered net'_      | Total energy delivered (net) tarrif 1 + tarrif 2 (kWh)                                                                                                                                             |
| `CURRENT_ELECTRICITY_USAGE`              | True     | string | _'Net power usage'_           | Current net power used (zero during delivery) in kWatt                                                                                                                                             |
| `CURRENT_ELECTRICITY_DELIVERY`           | True     | string | _'Net power delivery'_        | Current net power delivered (zero during import) in kWatt                                                                                                                                          |
| `ELECTRICITY_ACTIVE_TARIFF`              | True     | string | _'Active tariff'_             | The active tarrif (low of normal) values can be customized in `dsmr` section                                                                                                                       |
| `LONG_POWER_FAILURE_COUNT`               | True     | string | _'Long power failure count'_  | The number of 'long' power failures counted.                                                                                                                                                       |
| `SHORT_POWER_FAILURE_COUNT`              | True     | string | _'Short power failure count'_ | The number of 'shorted' power failures counted.                                                                                                                                                    |
| `VOLTAGE_SAG_L1_COUNT`                   | True     | string | _'Voltage sag count L1'_      | The number of power sags for fase L1 counted.                                                                                                                                                      |
| `VOLTAGE_SWELL_L1_COUNT`                 | True     | string | _'Voltage swell count L1'_    | The number of power swells for fase L1 counted.                                                                                                                                                    |
| `INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE` | True     | string | _'Net power usage L1'_        | Current net power used for fase L1 (zero during delivery) in Watt                                                                                                                                  |
| `INSTANTANEOUS_ACTIVE_POWER_L1_NEGATIVE` | True     | string | _'Net power delivery L1'_     | Current net power delivered for fase L1 (zero during import) in Watt                                                                                                                               |
| `current_net_power`                      | True     | string | _'Current net power'_         | The current net power (can be negative) in Watt                                                                                                                                                    |
| `current_net_power_l1`                   | True     | string | _'Current net power L1'_      | The current net power for fase L1 (can be negative) in Watt                                                                                                                                        |
| `INSTANTANEOUS_VOLTAGE_L1`               | True     | string | _'Net voltage L1'_            | The current net voltage in Volts for Fase L1 (rounded to an integer)                                                                                                                               |
| `net_voltage_max`                        | True     | string | _'Net voltage max'_           | The current maximum net voltage in Volts over all fases (rounded to an integer). Can be used as `net_voltage_fallback` key to publish voltage to pvoutput when no solar voltage data is available. |
| `INSTANTANEOUS_CURRENT_L1`               | True     | string | _'Net current L1 DSMR'_       | The current for fase L1 in Ampère (rounded to a positive integer) directly from your smart meter.                                                                                                  |
| `net_current_l1`                         | True     | string | _'Net current L1'_            | The current for fase L1 in Ampère calculated using `current_net_power_l1` / `INSTANTANEOUS_VOLTAGE_L1`. This gives a more precise current. Value is negative during enery delivery.                |

> The entries for fase L1 are also applicable for fase L2 and L3 if the data is available`

##### DSMR gas data - entity name override

| key                     | optional | type   | default                   | description                                                           |
| ----------------------- | -------- | ------ | ------------------------- | --------------------------------------------------------------------- |
| `timestamp_gas`         | True     | string | _'Last update gas meter'_ | Timestamp of the last gas meter data published.                       |
| `gas_consumption_total` | True     | string | _'Gas total'_             | The total amount of m3 gas delivered since installation of the meter. |
| `gas_consumption_hour`  | True     | string | _'Gas consumption'_       | The current consumption of gas in m3/hour.                            |

The unit of measurement the used icon, MQTT device_class and value template file can be customized by updating the file `data_fields.json`.
Make a copy of the original file and configure the path under the `data_config` key in the general setting.

### PVoutput plugin settings in the section `output.pvoutput` of `apps.yaml` or `config.yaml`

Register a free acount and API key at https://pvoutput.org/register.jsp

| key                        | optional | type   | default  | description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------------- | -------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sys_id`                   | True     | string | _(none)_ | Your unique system id, generated when creating an account at pvoutput.org. Enable publishing combined inverter data to this system id. You can also set `sys_id` in plant specific section to publish separate inverters.                                                                                                                                                                                                                                                                                                                                                        |
| `api_key`                  | False    | string | _(none)_ | Unique API access key generated at pvoutput.org                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `use_temperature`          | True     | bool   | `false`  | When set to true and `use_inverter_temperature` is not set, the temperature is obtained from OpenWeatherMap is submitted to pvoutput.org when logging the data.                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `use_inverter_temperature` | True     | bool   | `false`  | When set to true and `use_temperature` is set, the inverter temperature is submitted to pvoutput.org when logging the data. Only the clients `tcpclient` and `localproxy` are supported.                                                                                                                                                                                                                                                                                                                                                                                         |
| `publish_voltage`          | True     | string | _(none)_ | The _fieldname_ key of the voltage property to use for pvoutput 'addstatus' publishing. When set to `'voltage_ac_max'`, the maximal inverter AC voltage over all fases is submitted to pvoutput.org when logging the data. Only the clients `tcpclient` and `localproxy` are supported. Supported values are `voltage_ac1`, `voltage_ac2`, `voltage_ac3` or `voltage_ac_max` or one ofe the DSMR voltage fields (INSTANTANEOUS_VOLTAGE_L1 / \_L2, \_L3 or net_voltage_max) if DSMR is available. The field `net_voltage_max` holds the highest voltage over all available fases. |
| `net_voltage_fallback `    | True     | string | _(none)_ | The _fieldname_ key of the voltage property to use for pvoutput 'addstatus' publishing in case no solar data is available during sun down. When set to `'net_voltage_max'`, the maximal net voltage over all fases is submitted as alternative to pvoutput.org. This key only makes sens when using the DSMR integration.                                                                                                                                                                                                                                                        |

### CSVoutput plugin settings in the section `output.csvoutput` in of `apps.yaml` or `config.yaml`

| key               | optional | type   | default  | description                                                                                                                               |
| ----------------- | -------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
| `csvfile`         | True     | string | _(none)_ | Used by the client `csvoutput`. The file and path to append or create for csv logging.                                                    |
| `separator`       | True     | string | _;_      | Used by the client `csvoutput`. The separator/delimiter to use between headers and fields. Use '\t' to use a tab as separator.            |
| `no_headers`      | True     | bool   | _False_  | Used by the client `csvoutput`. If `csvoutput` will not write headers to the `csvfile`.                                                   |
| `fields`          | True     | list   | _[*]_    | Used by the client `csvoutput`. A list of fields to log. The fields `date` and `time` are specials fields to log the local date and time. |
| `use_temperature` | True     | bool   | _False_  | When set to true the `temperature` field is set in the data set which can be logged. The value is obtained from OpenWeatherMap.           |

#### Default fields and additional fields

Default fields assignment [*]:

- `date`
- `time`
- `current_power`
- `today_energy`
- `total_energy`

The following additional fields are available if DSMR data can be matched with the aggregated solar data:

- `energy_direct_use`
- `energy_used_net`
- `power_direct_use`
- `power_consumption`
- `last_update_calc`

### InfluxDB plugin settings in the section `output.influxdb` in of `apps.yaml` or `config.yaml`

| key               | optional | type    | default           | description                                                                  |
| ----------------- | -------- | ------- | ----------------- | ---------------------------------------------------------------------------- |
| `host`            | True     | string  | `localhost`       | Hostname or fqdn of the InfluxDB server for logging.                         |
| `port`            | True     | integer | `8086`            | InfluxDB port to be used.                                                    |
| `ssl`             | True     | bool    | `false`           | Use SSL. Set to `true` if the URL starts with `https://`                     |
| `verify_ssl`      | True     | bool    | `true`            | By default a certificate is validated. Set to `false` to disable validation. |
| `ssl_ca_cert`     | True     | string  | _(none)_          | Set an alternative CA cert. (InfluxDB 2.x client only)                       |
| `org`             | True     | string  | _(none)_          | The InfluxDB2 organisation (InfluxDB 2.x only)                               |
| `bucket`          | True     | string  | _(none)_          | The InfluxDB2 bucket to write to (InfluxDB 2.x only)                         |
| `token`           | True     | string  | _(none)_          | The InfluxDB2 authentication token (InfluxDB 2.x only)                       |
| `use_temperature` | True     | bool    | `false`           | When set to true the temperature is obtained from OpenWeatherMap and logged. |
| `database`        | True     | string  | _omnikdatalogger_ | The InfluxDB database (InfluxDB 1.8x only)                                   |
| `username`        | True     | string  | _(none)_          | The InfluxDB username used for Basic authentication (InfluxDB 1.8x only)     |
| `password`        | True     | string  | _(none)_          | The InfluxDB password used for Basic authentication (InfluxDB 1.8x only)     |
| `jwt_token`       | True     | string  | _(none)_          | The InfluxDB webtoken for JSON Web Token authentication (InfluxDB 1.8x only) |

Logging to InfluxDB is supported with configuration settings from `data_fields.json` The file allows to customize measurement header and allows setting additional tags.
When using InfluxDB2, authentication is mandantory. Configure `org`, `bucket` and `token` to enable the InfluxDB v2 client.

#### OpenWeatherMap settings in the section `openweathermap` of `apps.yaml` or `config.yaml`

_(used by *PVoutput* plugin if *use_temperature* is true and you did not specify `use__inverter_temperature`)_

Visit https://openweathermap.org/price to obtain a (free) api key. The weather data is cached with een TTL of 300 seconds.

| key        | optional | type   | default                  | description                                                            |
| ---------- | -------- | ------ | ------------------------ | ---------------------------------------------------------------------- |
| `api_key`  | False    | string | _(none)_                 | Unique access key generated at openweathermap.org                      |
| `endpoint` | True     | string | `api.openweathermap.org` | FQDN of the API endpoint.                                              |
| `lon`      | False    | float  | _(none)_                 | Longitude for the weather location                                     |
| `lat`      | False    | float  | _(none)_                 | Latitude for the weather location                                      |
| `units`    | True     | string | `metric`                 | Can be _metric_ (for deg. Celsius) or _imperial_ (for deg. Fahrenheit) |

### Device attribute settings and relation with `data_fields.json`

Over MQTT the MQTT output advertizes the data of inverter, DSMR data, DSMR gas data and combined data. These groups bound to device attributes that wil be associated withe entities that are being published.
In Home Assistant throug MQTT auto discovery this will show as seperate devices for 'Omnik' entities, 'DSMR' entities, 'DSMR gas' entities and 'DSMR_omnik' (combined) entities.
All fields are configured with the pre installed `data_fields.json` file. This file holds an `asset` property for each field which corresponds with the asset class.
Each asset class must have one field with `"dev_cla": "timestamp"` which is the timestamp field for that class.
If you want to omit field in your output you can personalize `data_fields.json`. Do NOT customize the shared version of `data_fields.json` but make a copy and configure the aternative path
using the [`data_config` key in get general section](https://github.com/jbouwh/omnikdatalogger#general-settings-of-appsyaml-or-configini).
The `attributes` section allows to customize some asset class settings.

| key                        | optional | type   | default                                                           | description                                                                                                                                                                                                                           |
| -------------------------- | -------- | ------ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `asset_classes`            | True     | list   | _omnik, omnik_dsmr, dsmr, dsmr_gas_                               | Access classes for device payload and grouping of entities.                                                                                                                                                                           |
| `asset.{asset_class}`      | True     | string | _see below_                                                       | Customize attribute payload for an asset class                                                                                                                                                                                        |
| `asset.omnik`              | True     | string | _inverter, plant_id, last_update_                                 | Standard attributes for published Omnik inverter data                                                                                                                                                                                 |
| `asset.omnik_dsmr`         | True     | string | _inverter, plant_id, EQUIPMENT_IDENTIFIER, terminal, last_update_ | Standard attributes for published combined DSMR and Omnik inverter data                                                                                                                                                               |
| `asset.dsmr                | True     | string | _EQUIPMENT_IDENTIFIER, terminal, timestamp_                       | Standard attributes for published DSMR data                                                                                                                                                                                           |
| `asset.dsmr_gas`           | True     | string | _EQUIPMENT_IDENTIFIER_GAS, terminal, timestamp_gas_               | Standard attributes for published DSMR gas data                                                                                                                                                                                       |
| `model.{asset_class}`      | True     | string | _see below_                                                       | Customize the model property of the device payload for an asset class                                                                                                                                                                 |
| `model.omnik`              | True     | string | _Omniksol_                                                        | Customize the model property of the device payload for the asset class `omnik` (Solar data)                                                                                                                                           |
| `model.omnik_dsmr`         | True     | string | _Omnik data logger_                                               | Customize the model property of the device payload for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                                      |
| `model.dsmr`               | True     | string | _DSRM electricity meter_                                          | Customize the model property of the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                                 |
| `model.dsmr_gas`           | True     | string | _DSRM gas meter_                                                  | Customize the model property of the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                                     |
| `mf.{asset_class}`         | True     | string | _see below_                                                       | Customize the manufacturer property of the device payload for an asset class                                                                                                                                                          |
| `mf.omnik`                 | True     | string | _Omnik_                                                           | Customize the manufacturer property of the device payload for the asset class `omnik` (Solar data)                                                                                                                                    |
| `mf.omnik_dsmr`            | True     | string | _JBsoft_                                                          | Customize the manufacturer property of the device payload for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                               |
| `mf.dsmr`                  | True     | string | _Netbeheer Nederland_                                             | Customize the manufacturer property of the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                          |
| `mf.dsmr_gas`              | True     | string | _Netbeheer Nederland_                                             | Customize mthe anufacturer property of the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                              |
| `identifier.{asset_class}` | True     | string | _see below_                                                       | Customize the identifier property of the device payload for an asset class. This property should be unique when using a configuration with more DSMR meters or plants The identifier will have the format {asset*class}*{identifier}. |
| `identifier.omnik`         | True     | string | _plant_id_                                                        | Customize the identifier property of the device payload for the asset class `omnik` (Solar data)                                                                                                                                      |
| `identifier.omnik_dsmr`    | True     | string | _plant_id_                                                        | Customize the identifier property of the device payload for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                                 |
| `identifier.dsmr`          | True     | string | _EQUIPMENT_IDENTIFIER_                                            | Customize the identifier property of the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                            |
| `identifier.dsmr_gas`      | True     | string | _EQUIPMENT_IDENTIFIER_GAS_                                        | Customize the property of the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                                           |
| `devicename.{asset_class}` | True     | string | _see below_                                                       | Customize the device name for an asset class. This attribute replaces the previous decrepated `device_name` setting in the `output.mqtt` section.                                                                                     |
| `devicename.omnik`         | True     | string | _Inverter_                                                        | Customize the device name for the asset class `omnik` (Solar data)                                                                                                                                                                    |
| `devicename.omnik_dsmr`    | True     | string | _Omnik_data_logger_                                               | Customize the device name for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                                                               |
| `devicename.dsmr`          | True     | string | _DSMR_electicity_meter_                                           | Customize the device name the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                                       |
| `devicename.dsmr_gas`      | True     | string | _DSMR_gasmeter_                                                   | Customize the device name the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                                           |

## Configuration using config.ini

Using a `config.ini` config file is no longer supported! Move your config a .yaml file in stead.

## Scheduled Run (commandline or using systemd)

You've got your default options to schedule this logger, but I included a `systemd` service file to run this as a service on Linux.

> **PS**: I'm using `Ubuntu 18.04 LTS` but Debian buster should also work.

First, install this thing (~ using Python 3.7+ !!!)

> If you don't have `Python3.7+` installed, do that first (~ don't forget to install `python3-pip` as well)

```
#### Create a to download the scripts
$ git clone https://github.com/jbouwh/omnikdatalogger
> onmiklogger.py can be found in the `./apps` folder
# check if properly installed
$ omniklogger.py -h
usage: omniklogger.py [-h] [--settings FILE] [--interval n] [-l]

optional arguments:
  -h, --help     show this help message and exit
  --settings FILE  Path to yaml configuration file
  --interval n   Execute every n seconds
  -l {DEBUG,INFO,WARNING,ERROR}, --loglevel {DEBUG,INFO,WARNING,ERROR} Loglevel
```

An example systemd script is available from `scripts/omnikdatalogger.service`. Copy it so you can customize it to your use.

Check the folowing line in this file in the script.

```
ExecStart=/usr/bin/python3 /usr/local/bin/omniklogger.py --settings /etc/omnik/config.yaml --interval 360
```

Make sure the interval is as desired and that the path of omniklogger.py is correct

Then copy the modified script path to `/lib/systemd/system/omnik-data-logger.service`

Next, enable and start service:

```
$ systemd enable omnikdatalogger
Created symlink /etc/systemd/system/multi-user.target.wants/omnikdatalogger.service → /lib/systemd/system/omnikdatalogger.service.
$ systemd start omnikdatalogger
```

Check if `omnikdatalogger.service` is running correctly:

```
$ systemd status omnikdatalogger
● omnikdatalogger.service - Omnik Data Logger service
   Loaded: loaded (/lib/systemd/system/omnikdatalogger.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2019-06-18 06:55:08 UTC; 4min 36s ago
 Main PID: 2445 (python3)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/omnikdatalogger.service
           └─2445 /usr/bin/python3 /usr/local/bin/omniklogger.py --settings /etc/omnik/config.yaml --interval 300
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jbouwh/omnikdatalogger",
    "name": "omnikdatalogger",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Jan Bouwhuis",
    "author_email": "jan@jbsoft.nl",
    "download_url": "https://files.pythonhosted.org/packages/d7/5e/18f6b0ac15701646b7be4b3af3a166778af3f16f1468f59ed456021894eb/omnikdatalogger-1.14.3.tar.gz",
    "platform": null,
    "description": "\ufeff# omnikdatalogger\n\n![PyPI version](https://badge.fury.io/py/omnikdatalogger.svg)\n[![hacs_badge](https://img.shields.io/badge/HACS-Default-orange.svg)](https://github.com/custom-components/hacs)\n\nOmnik 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.\nYou can also choose to log your data to pvoutput or an influx database or combine output options.\n\n## See also\n\n- [Omnik data logger Wiki](https://github.com/jbouwh/omnikdatalogger/wiki)\n- [Omnik data logger Website](https://jbsoft.nl/site/omnik-datalogger/)\n\n## Installation\n\nThe application can be installed:\n\n- Install with the Home Assistant Community Store [HACS](https://hacs.xyz/).\n  - Omnik data logger is included in the default repository. Open the Automation tab. Click on de big orange **+**\n  - Search for 'Omnik data logger' and select it.\n  - Choose 'Install this repository in HACS'\n- Download the latest release from [here](https://github.com/jbouwh/omnikdatalogger/releases)\n- Clone using git: `git clone https://gihub.com/jbouwh/omnikdatalogger`. Optional install with `pip3 install ./omnikdatalogger`.\n- Install using pip (pip3) as user: `pip3 install omnikdatalogger`\n- System install using pip (pip3): `sudo pip3 install omnikdatalogger`\n\nThe main application files are in the folder `apps/omnikdatalogger`\n\n## Usage\n\nThe application can be configured using:\n\n- Commandline (limited options available)\n- Configuration file (config.yaml)\n- apps.yaml configuration file (with AppDaemon) _(This applies tot HACS-users)_\n\n### Commandline\n\n```\nusage: [python3] omniklogger.py [-h] [--config FILE] [--interval n] [-d]\n\noptional arguments:\n  -h, --help     show this help message and exit\n  --settings FILE  Path to .yaml configuration file\n  --section  Section to .yaml configuration file to use. Defaults to the first section found.\n  --data_config FILE  Path to data_fields.json configuration file\n  --persistant_cache_file FILE  Path to writable cache json file to store last power en total energy\n  --interval n  execute every n seconds\n  -l {DEBUG,INFO,WARNING,ERROR}, --loglevel {DEBUG,INFO,WARNING,ERROR} Loglevel\n```\n\n> De default location for config using the commandline is `~/.omnik/config.yaml`.\n\n### Configuration using apps.yaml (AppDeamon) (with possible HomeAssistant integration)\n\n#### Preparation for scheduled use with AppDaemon4\n\nThis a new feature is the integration AppDaemon which makes an integration with Home Assistant possible\n\nAppDaemon4 can be installed within the HomeAssistant environment using the Add-on store from the Home Assistant Community Add-ons\nAn alternative is appdaemon with pip. See: https://pypi.org/project/appdaemon/\n\nWhen AppDaemon is used with Home Assistant the following base configuration could be used:\n\n```yaml\nsystem_packages: []\npython_packages:\n  - cachetools\n  - dsmr-parser\n  - influxdb-client\ninit_commands: []\nlog_level: info\n```\n\nThe 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.\n\nWhen used with HACS the dependencies in [requirements.txt](https://github.com/jbouwh/omnikdatalogger/blob/master/requirements.txt) should be installed automatically.\n\nThe basescript omniklogger.py holds a class HA_OmnikDataLogger that implements appdaemon.plugins.hass.hassapi\nSee for more information and documentation about AppDaemon: https://appdaemon.readthedocs.io/en/latest/APPGUIDE.html\n\nThe configfile /config/appdaemon/appdaemon.yaml needs a minimal configuration. Further it is possible to define the location for your logfiles. And example configuration is:\n\n```yaml\nappdaemon:\n  latitude: 0.0\n  longitude: 0.0\n  elevation: 0.0\n  time_zone: Europe/Amsterdam\n  plugins:\n    HASS:\n      type: hass\nhttp:\n  url: http://homeassistant:5050/\nadmin:\napi:\nhadashboard:\nlogs:\n  main_log:\n    filename: /config/appdaemon/log/appdaemon.log\n  error_log:\n    filename: /config/appdaemon/log/appdaemon.err\n```\n\nMake sure the url is accessible with the hostname you configure.\n\n#### Configuring `apps.yaml` to use Omnik Data Logger with AppDaemon4\n\nInstall the datalogger files from git under /config/appdaemon/apps/omnikdatalogger\n\nThe base script is located at:\n\n```\n/config/appdaemon/apps/omnikdatalogger/omniklogger.py\n```\n\nNext 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.\n\nThis configuration is placed in the file: `/config/appdaemon/apps/apps.yaml`.\n\n#### Full Configuration Example of `config.yaml`/`apps.yaml`:\n\n```yaml\n# The instance name is omnik_datalogger, this can be changed. Multiple instances are supported.\nomnik_datalogger:\n  # General options\n  module: omniklogger\n  class: HA_OmnikDataLogger\n  city: Amsterdam\n  interval: 360\n\n  # plugin section\n  plugins:\n    # plugins for data logging (output)\n    output:\n      - pvoutput\n      - mqtt\n      - influxdb\n      - csvoutput\n    # plugins for local proxy client (list)\n    localproxy:\n      - hassapi\n    #     - mqtt_proxy\n    #     - tcp_proxy\n    # the client that is beging used (choose one)\n    # valid clients are localproxy, solarmanpv and tcpclient\n    client: localproxy\n\n  # attributes override\n  attributes:\n    devicename.omnik: Omvormer\n  #   model.omnik: Omnik data logger\n\n  #DSMR support\n  dsmr:\n    terminals:\n      - term1\n    tarif:\n      - \"0001\"\n      - \"0002\"\n    tarif.0001: laag\n    tarif.0002: normaal\n\n  dsmr.term1:\n    # use mode tcp or device\n    mode: tcp\n    host: 172.17.0.1\n    port: 3333\n    device: /dev/ttyUSB0\n    dsmr_version: \"5\"\n    total_energy_offset: 15338.0\n    gas_meter: true\n\n  # Section for your inverters specific settings\n  plant.123:\n    inverter_address: 192.168.1.1\n    logger_sn: 123456789\n    inverter_port: 8899\n    inverter_sn: NLxxxxxxxxxxxxxx\n    sys_id: <YOUR SYSTEM ID>\n    # CSV output for specific plant\n    csvfile: \"/some_path/output.178735.csv\"\n    separator: \";\"\n    no_headers: false\n    fields:\n      - date\n      - time\n      - current_power\n      - today_energy\n      - total_energy\n      - inverter\n\n  # Section for the localproxy client\n  client.localproxy:\n    plant_id_list:\n      - \"123\"\n  # Section for the localproxy plugin hassapi\n  client.localproxy.hassapi:\n    logger_entity: binary_sensor.datalogger\n  # Section for the localproxy plugin mqtt_proxy\n  client.localproxy.mqtt_proxy:\n    logger_sensor_name: Datalogger\n    discovery_prefix: homeassistant\n    host: homeassistant.example.com\n    port: 1883\n    client_name_prefix: ha-mqtt-omniklogger\n    username: mqttuername\n    password: mqttpasswordabcdefgh\n  # Section for the localproxy plugin tcp_proxy\n  client.localproxy.tcp_proxy:\n    listen_address: \"0.0.0.0\"\n    listen_port: \"10004\"\n\n  # Solarmanpv API options\n  client.solarmanpv:\n    username: john.doe@example.com\n    password: some_password\n\n  # Influxdb output plugin configuration options\n  output.influxdb:\n    # Common settings\n    host: localhost\n    port: 8086\n    ssl: false #  # Use SSL\n    verify_ssl: true # Verify SSL certificate for HTTPS request\n\n    use_temperature: true # If true logs the temperature of the openweathermap API\n\n    # InfluxDB v1 only\n    database: omnikdatalogger\n    username: omnikdatalogger\n    password: mysecretpassword\n    #jwt_token=\n\n    # InfluxDB v2 only\n    org: jbsoft\n    bucket: omnik\n    token: generatedtoken\n    ssl_ca_cert: path_to_custom_ca.crt # Only for InfluxDB 2!\n\n  # csvoutput output plugin configuration options\n  output.csvoutput:\n    # CSV output for aggregated data\n    csvfile: \"/some_path/output.csv\"\n    separator: \";\"\n    no_headers: false\n    use_temperature: true\n    fields:\n      - date\n      - time\n      - current_power\n      - today_energy\n      - total_energy\n      - temperature\n\n  # PVoutput output plugin configuration options\n  output.pvoutput:\n    sys_id: 12345\n    api_key: jadfjlasexample0api0keykfjasldfkajdflasd\n    use_temperature: true\n    use_inverter_temperature: true\n    publish_voltage: voltage_ac_max\n\n  # Open Weather map options\n  openweathermap:\n    api_key: someexampleapikeygenerateone4you\n    endpoint: api.openweathermap.org\n    lon: 4.0000000\n    lat: 50.1234567\n    units: metric\n\n  # MQTT output plugin configuration options\n  output.mqtt:\n    username: mqttuername\n    password: mqttpasswordabcdefgh\n    device_name: Omvormer\n    append_plant_id: false\n    # Omnik\n    current_power_name: Vermogen zonnepanelen\n    total_energy_name: Gegenereerd totaal\n    today_energy_name: Gegenereerd vandaag\n    last_update_name: Laatste statusupdate\n    inverter_temperature_name: Temperatuur omvormer\n    current_ac1_name: Stroom AC\n    current_ac2_name: Stroom AC fase 2\n    current_ac3_name: Stroom AC fase 3\n    voltage_ac_max_name: Spanning AC max\n    voltage_ac1_name: Spanning AC fase 1\n    voltage_ac2_name: Spanning AC fase 2\n    voltage_ac3_name: Spanning AC fase 3\n    frequency_ac1_name: Netfrequentie\n    frequency_ac2_name: Netfrequentie fase 2\n    frequency_ac3_name: Netfrequentie fase 3\n    power_ac1_name: Vermogen AC\n    power_ac2_name: Vermogen AC fase 2\n    power_ac3_name: Vermogen AC fase 3\n    voltage_pv1_name: Spanning DC 1\n    voltage_pv2_name: Spanning DC 2\n    voltage_pv3_name: Spanning DC 3\n    current_pv1_name: Stroom DC 1\n    current_pv2_name: Stroom DC 2\n    current_pv3_name: Stroom DC 3\n    power_pv1_name: Vermogen DC 1\n    power_pv2_name: Vermogen DC 2\n    power_pv3_name: Vermogen DC 3\n    current_power_pv_name: Vermogen DC\n    operation_hours_name: Actieve uren\n    # DSMR\n    timestamp_name: Update slimme meter\n    ELECTRICITY_USED_TARIFF_1_name: Verbruik (laag)\n    ELECTRICITY_USED_TARIFF_2_name: Verbruik (normaal)\n    ELECTRICITY_DELIVERED_TARIFF_1_name: Genereerd (laag)\n    ELECTRICITY_DELIVERED_TARIFF_2_name: Gegenereerd (normaal)\n    energy_used_net_name: Verbruikt (net)\n    energy_delivered_net_name: Gegenereerd (net)\n    CURRENT_ELECTRICITY_USAGE_name: Verbruik (net)\n    CURRENT_ELECTRICITY_DELIVERY_name: Teruglevering (net)\n    ELECTRICITY_ACTIVE_TARIFF_name: Tarief\n    LONG_POWER_FAILURE_COUNT_name: Onderbrekingen (lang)\n    SHORT_POWER_FAILURE_COUNT_name: Onderbrekingen (kort)\n    VOLTAGE_SAG_L1_COUNT_name: Net dips L1\n    VOLTAGE_SAG_L2_COUNT_name: Net dips L2\n    VOLTAGE_SAG_L3_COUNT_name: Net dips L3\n    VOLTAGE_SWELL_L1_COUNT_name: Net pieken L1\n    VOLTAGE_SWELL_L2_COUNT_name: Net pieken L2\n    VOLTAGE_SWELL_L3_COUNT_name: Net pieken L3\n    INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE_name: Gebruik L1\n    INSTANTANEOUS_ACTIVE_POWER_L2_POSITIVE_name: Gebruik L2\n    INSTANTANEOUS_ACTIVE_POWER_L3_POSITIVE_name: Gebruik L3\n    INSTANTANEOUS_ACTIVE_POWER_L1_NEGATIVE_name: Teruglevering L1\n    INSTANTANEOUS_ACTIVE_POWER_L2_NEGATIVE_name: Teruglevering L2\n    INSTANTANEOUS_ACTIVE_POWER_L3_NEGATIVE_name: Teruglevering L3\n    current_net_power_name: Vermogen (net)\n    current_net_power_l1_name: Vermogen L1\n    current_net_power_l2_name: Vermogen L2\n    current_net_power_l3_name: Vermogen L3\n    INSTANTANEOUS_VOLTAGE_L1_name: Spanning L1\n    INSTANTANEOUS_VOLTAGE_L2_name: Spanning L2\n    INSTANTANEOUS_VOLTAGE_L3_name: Spanning L3\n    INSTANTANEOUS_CURRENT_L1_name: Stroom L1 DSMR\n    INSTANTANEOUS_CURRENT_L2_name: Stroom L2 DSMR\n    INSTANTANEOUS_CURRENT_L3_name: Stroom L3 DSMR\n    net_current_l1_name: Stroom L1\n    net_current_l3_name: Stroom L2\n    net_current_l2_name: Stroom L3\n    net_voltage_max_name: Netspanning max\n    # DSMR gas\n    timestamp_gas_name: Update gasmeter\n    gas_consumption_total_name: Verbruik gas totaal\n    gas_consumption_hour_name: Verbruik gas\n    # omnik_DSMR (combined)\n    last_update_calc_name: Update berekening\n    energy_used_name: Verbruikt totaal\n    energy_direct_use_name: Direct verbruikt\n    power_consumption_name: Verbruik\n    power_direct_use_name: Direct verbruik\n```\n\n## Configuration keys (required, optional and defaults)\n\nThe .yaml file configuration file used from the command line has the same structure as `apps.yaml`\n\nThe first section in `config.yaml` will be used (see event log).\n\n### General settings\n\n#### General settings - `apps.yaml` 'only' configuration options\n\n> All configuration settings are placed unther the instance_name key default is `omnik_datalogger:`.\n\n| key      | optional | type   | default  | description                                                                                                                        |\n| -------- | -------- | ------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |\n| `module` | False    | string | _(none)_ | Should be the name of the base script `omniklogger`. A path should not be configured. AppDaemon wil find the module automatically. |\n| `class`  | False    | string | _(none)_ | Should be the name of the class hat implements 'appdaemon.plugins.hass.hassapi'. This value should be `HA_OmnikDataLogger`.        |\n\n#### General settings of `apps.yaml` or `config.yaml`\n\n> All configuration settings are placed unther the instance_name key default is `omnik_datalogger:`.\n\n| key                     | optional | type    | default                                | description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\n| ----------------------- | -------- | ------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `city`                  | True     | string  | `Amsterdam`                            | City name recognizable by the Astral python module. Based on this city the data logging is disabled from dusk to dawn. This prevents unneccesary calls to the omnik portal.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |\n| `interval`              | True     | integer | `360`                                  | The number of seconds of the interval between the last update timestamp and the next poll. At normal conditions the omnik portal produces a new report approx. every 300 sec. With an interval of 360 a new pol is done with max 60 delay. This enabled fluctuation in the update frequency of the omnik portal. If there is not enough time left to wait (less than 10 sec) and no new report was found at the omnik portal another period of _interval_ seconds will be waited. After an error calling the omnik API another half _interval_ will be waited before the next poll will be done. A pushing client as `localproxy` is, needs an interval te be set when used from the command line higher then 0. The interval it self is not used since the data is pushed. When no interval is given at the command line (or in a systemd setup) the executable will stop automatically after one reading! |\n| `data_config`           | True     | string  | `{path to installed data_fields.json}` | The path to the `data_fields.json`. De default is looking in the folder of the executable. When installed using _pip_ `data_fields.json` is installd in the folder `./shared/omnikdatalogger/data_fields.json`. With this parameter you can savely make your own copy and customize it.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |\n| `persistant_cache_file` | True     | string  | `{./persistant_cache.json}`            | The path to the `persistant_cache.json` file. This file must be writable since its stores the latest total energy and power. When using docker containers, place this file out of your container.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |\n\n#### Plugin settings in the section `plugins` of `apps.yaml` or `config.yaml`\n\n| key          | optional | type   | default        | description                                                                                                                                                                                                  |\n| ------------ | -------- | ------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `client`     | False    | string | _(none)_       | Name of the client that will be used to fetch the data. Valid choices are `localproxy`, `tcp_client`, or `solarmanpv`.                                                                                       |\n| `localproxy` | True     | list   | _(none)_       | The client plugings for the `localproxy` client that will be used to fetch the data. Valid choices are `tcp_proxy`, `mqtt_proxy` or `hassapi`.                                                               |\n| `output`     | True     | list   | _(empty list)_ | A (yaml) list of string specifying the name(s) of the output plugins to be used. Available plugins are `pvoutput`, `influxdb`, `csvoutput` and `mqtt`. If no plugins are configured, nothing will be logged. |\n\n#### DSMR settings in the section `dsmr` of `apps.yaml` or `config.yaml`\n\n| key          | optional | type   | default            | description                                                                                                                             |\n| ------------ | -------- | ------ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------- |\n| `terminals ` | False    | list   | _(empty list)_     | List of DSMR terminals. Eacht termial has settings at section [dsrm.{terminal_name}]. An empty list disables the DSMR integration.      |\n| `tarif.0001` | True     | string | _low_              | Tarif value override for tarif 0001 (low). If you need outher tarifs then 0001 or 0002 the configure the tarif key.                     |\n| `tarif.0002` | True     | string | _normal_           | Tarif value override for tarif 0002 (normal)                                                                                            |\n| `tarif`      | True\"    | list   | _['0001', '0002']_ | Use only if your meter has other tarifs then 0001 and 0002 and you want to override the name. (Not needed in the Netherlands I suppose) |\n\n##### DSMR settings in the section `dsmr.{terminal_name}` of `apps.yaml` or `config.yaml`\n\n| key                   | optional | type    | default     |                                                                                                                                                                                                |\n| --------------------- | -------- | ------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `mode`                | True     | string  | _device_    | Mode for the DSMR terminal. Mode can be `device` (default) or `tcp`)                                                                                                                           |\n| `host `               | True     | string  | _localhost_ | When using tcp, the host or IP-address to connect to (e.g. a ser2net instance).                                                                                                                |\n| `port `               | True     | int     | _3333_      | When using tcp, the port to connect to (e.g. a ser2net instance).                                                                                                                              |\n| `plant_id`            | True     | string  | _(none)_    | Associates the DSMR data with the Omnik plant data. Use only when you have multiple inverters that use a different DSMR meter.                                                                 |\n| `dsmr_version`        | True     | string  | _'5'_       | The DSMR version of your smart meter. Choices: '2.2', '4', '5', '5B' (For Belgian Meter). Default = '5'                                                                                        |\n| `gas_meter`           | True     | boolean | _true_      | The DSMR meter has a connected gas meter to read out.                                                                                                                                          |\n| `total_energy_offset` | True     | float   | _0.0_       | The start value of your solar system used to calculated the total energy consumption. When no `plant_id` is specified this start value is the `total_energy_offset` of all inverters together. |\n\n## Client settings\n\nEvery client and client plugin has an own section with configuration keys. Additional for every plant there is a section with plant specific settings.\n\n### Plant specific settings in the section `plant.*plant_id*` of `apps.yaml` or `config.yaml`\n\nDetails for the plant are set in section `plant.{plant id}]`. Replace _plant_id_ with the plant id of your system (you can choose you own id). Every plant has its own section. Possible keys in this section are:\n\n| key                | optional | type   | default                                | description                                                                                                                                                                                                |\n| ------------------ | -------- | ------ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `inverter_address` | True     | string | _(none)_                               | The IP-adres of your inverter. Used by the client `tcpclient` to access the inverter.                                                                                                                      |\n| `logger_sn`        | True     | int    | _(none)_                               | The logger module serial number of your inverter. Used by the client `tcpclient` to access the inverter.                                                                                                   |\n| `inverter_port`    | True     | int    | _8899_                                 | The the tcp port your inverter listens to (default to 8899). Used by the client `tcpclient` to access the inverter.                                                                                        |\n| `inverter_sn`      | False    | string | _(none)_                               | The serial number of the inverter. Used by the clients `tcpclient` and `localproxy` to map `inverter_sn` and `plant_id` to validate/filter the raw data messages received.                                 |\n| `http_only`        | True     | bool   | _False_                                | Used by the client `tcpclient`. The client will not try to connect the inverter over port `8899` but will use the fallback method to fetch a status update using http://{inverter_address}:80/js/status.js |\n| `sys_id`           | True     | int    | _`sys_id` at the `[pvoutput]` section_ | Your unique system id, generated when creating an account at pvoutput.org. This setting allows the specific inveterdata to be published at pvoutput.org. See `pvoutput` settings for more information.     |\n| `logger_entity`    | True     | string | _(none)_                               | When using the `localproxy` client with `hassapi`, this specifies the inverter entity created through `omnikdataloggerproxy` that receives new updates for the inverter.                                   |\n| `csvfile`          | True     | string | _(none)_                               | Used by the client `csvoutput`. The file and path to append or create for csv logging.                                                                                                                     |\n| `separator`        | True     | string | _;_                                    | Used by the client `csvoutput`. The separator/delimiter to use between headers and fields. Use '\\t' to use a tab as separator.                                                                             |\n| `no_headers`       | True     | bool   | _False_                                | Used by the client `csvoutput`. If `csvoutput` will not write headers to the `csvfile`.                                                                                                                    |\n| `fields`           | True     | list   | _[*]_                                  | Used by the client `csvoutput`. A list of fields to log. The fields `date` and `time` are specials fields to log the local date and time.                                                                  |\n| `use_temperature`  | True     | bool   | _False_                                | When set to true the `temperature` field is set in the data set which can be logged to CSV. The value is obtained from OpenWeatherMap.                                                                     |\n\n[*] == [\n\"date\",\n\"time\",\n\"current_power\",\n\"today_energy\",\n\"total_energy\",\n]\n\n### TCPclient client settings in the section `client.tcpclient` of `apps.yaml` or `config.yaml`\n\n| key             | optional | type | default  | description                                                                                                                                                                                            |\n| --------------- | -------- | ---- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `plant_id_list` | False    | list | _(none)_ | List with the plant id's you want to be monitored. Details for the plant are set in section `plant.{plant id}]`. Replace _plant_id_ with the plant id of your system. Every plant has its own section. |\n\n### LocalProxy client settings in the section `client.localproxy` of `apps.yaml` or `config.yaml`\n\n| key             | optional | type | default  | description                                                                                                                                                                               |\n| --------------- | -------- | ---- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `plant_id_list` | False    | list | _(none)_ | List with the plant id's you monitor. Details for the plant are set in section `plant.{plant id}]`. Replace _plant_id_ with the plant id of your system. Every plant has its own section. |\n\nThe LocalProxy client uses input plugins that are used to collect the data.\nThe `omnikloggerproxy.py` script (See `https://github.com/jbouwh/omnikdataloggerproxy`) enable to proxy the raw logger data to MQTT and can help to forward your data to omnikdatalogger and still support forwarding the logging to the the legacy portal of Omnik/Solarman.\nMultiple plugins can be enabled, but usualy you will use one of these input pluging. The decoding is based on _(https://github.com/Woutrrr/Omnik-Data-Logger)_ by Wouter van der Zwan.\nThe plugings for the `localproxy` client are:\n\n- `tcp_proxy`: Listens to directed inverter input on port 10004. See _tcp_proxy_ paragraph. Yo need to forward the inverter traffic to be able to intercept your inverter data.\n- `mqtt_proxy`: Listens to a MQTT topic to retreive the data. Use `omnikloggerproxy.py` to forward to your MQTT server.\n- `hassapi`: Listens to a homeassitant entity (ascociated with MQTT) using the HASSAPI in AppDaemon. This plugin is prefered for use in combination with Home Assistant.\n\n#### `tcp_proxy` plugin for the `localproxy` client in the section `client.localproxy.tcp_proxy` of `apps.yaml` or `config.yaml`\n\n| key              | optional | type   | default     | description                |\n| ---------------- | -------- | ------ | ----------- | -------------------------- |\n| `listen_address` | True     | string | _'0.0.0.0'_ | The IP-adres to listen to. |\n| `listen_port`    | True     | string | _'10004'_   | The port to listen to.     |\n\n#### `mqtt_proxy` plugin for the `localproxy` client in the section `client.localproxy.mqtt_proxy` of `apps.yaml` or `config.yaml`\n\n| key                  | optional | type    | default                                                                 | description                                                                                                                                                      |\n| -------------------- | -------- | ------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `logger_sensor_name` | True     | string  | _'Datalogger'_                                                          | The mqtt topic is assembled as {mqtt.discovery*prefix }/binary_sensor/{logger_sensor_name}*{serialnumber}                                                        |\n| `discovery_prefix`   | True     | string  | _(key under the `output.mqtt` section)_                                 | The mqtt plugin supports MQTT auto discovery with Home Assistant. The discovery_prefix configures the topic prefix Home Assistant listens to for auto discovery. |\n| `host`               | True     | string  | _(key under the `output.mqtt` section)_                                 | Hostname or fqdn of the MQTT server for publishing.                                                                                                              |\n| `port`               | True     | integer | _(key under the `output.mqtt` section)_                                 | MQTT port to be used.                                                                                                                                            |\n| `client_name_prefix` | True     | string  | _(key under the `output.mqtt` section) then `ha-mqttproxy-omniklogger`_ | Defines a prefix that is used as client name. A 4 byte uuid is added to ensure an unique ID.                                                                     |\n| `username`           | False    | string  | _(key under the `output.mqtt` section)_                                 | The MQTT username used for authentication                                                                                                                        |\n| `password`           | False    | string  | _(key under the `output.mqtt` section)_                                 | The MQTT password used for authentication                                                                                                                        |\n| `tls`                | True     | bool    | _(key under the `output.mqtt` section)_                                 | Secures the connection to the MQTT service, the MQTT server side needs a valid certificate                                                                       |\n| `ca_certs`           | True     | string  | _(key under the `output.mqtt` section)_                                 | File path to a file containing alternative CA's. If not configure the systems default CA is used                                                                 |\n| `client_cert`        | True     | string  | _(key under the `output.mqtt` section)_                                 | File path to a file containing a PEM encoded client certificate                                                                                                  |\n| `client_key`         | True     | string  | _(key under the `output.mqtt` section)_                                 | File path to a file containing a PEM encoded client private key                                                                                                  |\n\n#### `hassapi` plugin for the `localproxy` client in the section `client.localproxy.hassapi` of `apps.yaml` or `config.yaml`\n\n| key             | optional | type   | default                      | description                                                                                                                                                                                              |\n| --------------- | -------- | ------ | ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `logger_entity` | True     | string | _'binary_sensor.datalogger'_ | The entity name of the datalogger object in Home Assistant created by the mqtt output of the `omnikloggerproxy.py` script. With multiple inverters use `logger_entity` with the plant specific settings. |\n\n### SolarmanPV client settings in the section `client.solarmanpv` of `apps.yaml` or `config.yaml`\n\n| key        | optional | type   | default  | description                                                                                       |\n| ---------- | -------- | ------ | -------- | ------------------------------------------------------------------------------------------------- |\n| `username` | False    | string | _(none)_ | Your Omikportal or SolarmanPV username                                                            |\n| `password` | False    | string | _(none)_ | Your Omikportal or SolarmanPV password                                                            |\n| `app_id`   | True     | string | _(none)_ | The API id used to access your data. If configured, this will override the default assigned id.   |\n| `app_key`  | True     | string | _(none)_ | The API key used to access your data. If configured, this will override the default assigned key. |\n\n## Output plugins\n\n### MQTT plugin\n\nYou can use the the official add-on 'Mosquito broker' for the MQTT integration in HomeAssistant\nMake sure you configure an account that has access to the MQTT service.\nTo integrate with HomeAssistant make sure a username/password combination is added to the Mosquito config like:\nThe datalogger uses the paho.mqtt.client for connnecting to the MQTT broker.\n\n```yaml\nlogins:\n  - username: mymqttuser\n    password: mysecretpassword\n```\n\nRestart Mosquito after changing the config.\n\n#### MQTT settings in the section `output.mqtt` of `apps.yaml` or `config.yaml`\n\n| key                  | optional | type    | default                 | description                                                                                                                                                      |\n| -------------------- | -------- | ------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `discovery_prefix`   | True     | string  | _'homeassistant'_       | The mqtt plugin supports MQTT auto discovery with Home Assistant. The discovery_prefix configures the topic prefix Home Assistant listens to for auto discovery. |\n| `device_name`        | True     | string  | _'Datalogger proxy'_    | Omnik data logger proxy only setting. Overrides the name of the datalogger in the omnik portal. See also the `attributes` section below.                         |\n| `append_plant_id`    | True     | bool    | _false_                 | When a device_name is specified the plant id can be added to the name te be able to identify the plant.                                                          |\n| `host`               | True     | string  | `localhost`             | Hostname or fqdn of the MQTT server for publishing.                                                                                                              |\n| `port`               | True     | integer | _1883_                  | MQTT port to be used.                                                                                                                                            |\n| `retain`             | True     | bool    | _True_                  | Retains the data send to the MQTT service                                                                                                                        |\n| `client_name_prefix` | True     | string  | _'ha-mqtt-omniklogger'_ | Defines a prefix that is used as client name. A 4 byte uuid is added to ensure an unique ID.                                                                     |\n| `username`           | False    | string  | _(none)_                | The MQTT username used for authentication                                                                                                                        |\n| `password`           | False    | string  | _(none)_                | The MQTT password used for authentication                                                                                                                        |\n| `tls`                | True     | bool    | _False_                 | Secures the connection to the MQTT service, the MQTT server side needs a valid certificate                                                                       |\n| `ca_certs`           | True     | string  | _(none)_                | File path to a file containing alternative CA's. If not configure the systems default CA is used                                                                 |\n| `client_cert`        | True     | string  | _(none)_                | File path to a file containing a PEM encoded client certificate                                                                                                  |\n| `client_key`         | True     | string  | _(none)_                | File path to a file containing a PEM encoded client private key                                                                                                  |\n\n#### Renaming entities. (Keys are like {fieldname}\\_name)\n\n_For every solar plant, 4 entities are added to the mqtt auto discovery. The default name can be configured._\n\n##### Omnik solar data - entity name override\n\n| key                         | optional | type   | default                | description                                                                                                          |\n| --------------------------- | -------- | ------ | ---------------------- | -------------------------------------------------------------------------------------------------------------------- |\n| `current_power_name`        | True     | string | `Current power`        | Name override for the entity that indicates the current power in Watt the solar plant is producing.                  |\n| `total_energy_name`         | True     | string | `Energy total`         | Name override for the entity that indicates total energy in kWh the solar plant has generated since installation.    |\n| `today_energy_name`         | True     | string | `Energy today`         | Name override for the entity that indicates total energy in kWh the solar plant has generated this day.              |\n| `last_update_time_name`     | True     | string | `Last update`          | Name override for the entity that is a timestamp total of the last update of the solar plant.                        |\n| `name`                      | True     | string | `Current power`        | Name override for the entity that indicates the current power in Watt the solar plant is producing.                  |\n| `inverter_temperature_name` | True     | string | `Inverter temperature` | Name override for inverters Temperature. Only the clients `tcpclient` and `localproxy` are supported.                |\n| `current_ac1_name`          | True     | string | `AC Current fase R`    | Name override for AC Current fase 1. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `current_ac2_name`          | True     | string | `AC Current fase S`    | Name override for AC Current fase 2. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `current_ac3_name`          | True     | string | `AC Current fase T`    | Name override for AC Current fase 3. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `voltage_ac1_name`          | True     | string | `AC Voltage fase R`    | Name override for AC Voltage fase 1. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `voltage_ac2_name`          | True     | string | `AC Voltage fase S`    | Name override for AC Voltage fase 2. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `voltage_ac3_name`          | True     | string | `AC Voltage fase T`    | Name override for AC Voltage fase 3. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `voltage_ac_max_name`       | True     | string | `AC Voltage max`       | Name override for the maximal AC Voltage over al fases. Only the clients `tcpclient` and `localproxy` are supported. |\n| `frequency_ac1_name`        | True     | string | `AC Frequency fase R`  | Name override for AC Frequency fase 1. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `frequency_ac2_name`        | True     | string | `AC Frequency fase S`  | Name override for AC Frequency fase 2. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `frequency_ac3_name`        | True     | string | `AC Frequency fase T`  | Name override for AC Frequency fase 3. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `power_ac1_name`            | True     | string | `AC Power fase R`      | Name override for AC Power fase 1. Only the clients `tcpclient` and `localproxy` are supported.                      |\n| `power_ac2_name`            | True     | string | `AC Power fase S`      | Name override for AC Power fase 2. Only the clients `tcpclient` and `localproxy` are supported.                      |\n| `power_ac3_name`            | True     | string | `AC Power fase T`      | Name override for AC Power fase 3. Only the clients `tcpclient` and `localproxy` are supported.                      |\n| `voltage_pv1_name`          | True     | string | `DC Voltage string 1`  | Name override for PV Voltage string 1. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `voltage_pv2_name`          | True     | string | `DC Voltage string 2`  | Name override for PV Voltage string 2. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `voltage_pv3_name`          | True     | string | `DC Voltage string 3`  | Name override for PV Voltage string 3. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `current_pv1_name`          | True     | string | `DC Current string 1`  | Name override for PV Current string 1. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `current_pv2_name`          | True     | string | `DC Current string 2`  | Name override for PV Current string 2. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `current_pv3_name`          | True     | string | `DC Current string 3`  | Name override for PV Current string 3. Only the clients `tcpclient` and `localproxy` are supported.                  |\n| `power_pv1_name`            | True     | string | `DC Power string 1`    | Name override for PV Power string 1. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `power_pv2_name`            | True     | string | `DC Power string 2`    | Name override for PV Power string 2. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `power_pv3_name`            | True     | string | `DC Power string 3`    | Name override for PV Power string 3. Only the clients `tcpclient` and `localproxy` are supported.                    |\n| `current_power_pv_name`     | True     | string | `DC Current power`     | Name override for PV total power. Only the clients `tcpclient` and `localproxy` are supported.                       |\n| `operation_hours_name`      | True     | string | `Hours active`         | Name override for the oprational hours of the inverter. Only the clients `tcpclient` and `localproxy` are supported. |\n\n##### DSMR and Omnik solar combined data - entity name override\n\n| key                 | optional | type   | default                      | description                                                                                                                                                                                                                                           |\n| ------------------- | -------- | ------ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `last_update_calc`  | True     | string | _'Last update calculations'_ | Timestamp for calculated combined values of DSMR and solar data                                                                                                                                                                                       |\n| `energy_used`       | True     | string | _'Energy used'_              | Total energy used since installation of the smart meter. The `total_energy_offset` setting enables is meant to configure the `total energy` of your solar system at the installation of the smart meter.                                              |\n| `energy_direct_use` | True     | string | _'Energy used directly'_     | The direct used energy (consumed and not delivered to the net) since installation of the smart meter. The `total_energy_offset` setting enables is meant to configure the `total energy` of your solar system at the installation of the smart meter. |\n| `power_consumption` | True     | string | _'Current consumption'_      | The current power consumption (direct and imported power).                                                                                                                                                                                            |\n| `power_direct_use`  | True     | string | _'Direct consumption'_       | The direct power consumption (directly used from your generated power and not deliverd to the net).                                                                                                                                                   |\n\n##### DSMR data - entity name override\n\n| key                                      | optional | type   | default                       | description                                                                                                                                                                                        |\n| ---------------------------------------- | -------- | ------ | ----------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `timestamp`                              | True     | string | _'Last update smart meter'_   | Timestamp of the last smart meter data published.                                                                                                                                                  |\n| `ELECTRICITY_USED_TARIFF_1`              | True     | string | _'Energy used tariff 1'_      | Total energy consumption at low tariff (kWh)                                                                                                                                                       |\n| `ELECTRICITY_USED_TARIFF_2`              | True     | string | _'Energy used tariff 2'_      | Total energy consumption at normal tariff (kWh)                                                                                                                                                    |\n| `ELECTRICITY_DELIVERED_TARIFF_1`         | True     | string | _'Energy delivered tariff 1'_ | Total energy delivery at low tariff (kWh)                                                                                                                                                          |\n| `ELECTRICITY_DELIVERED_TARIFF_2`         | True     | string | _'Energy delivered tariff 2'_ | Total energy delivery at normal tariff (kWh)                                                                                                                                                       |\n| `energy_used_net`                        | True     | string | _'Energy used net'_           | Total energy used (net) tarrif 1 + tarrif 2 (kWh)                                                                                                                                                  |\n| `energy_delivered_net`                   | True     | string | _'Energy delivered net'_      | Total energy delivered (net) tarrif 1 + tarrif 2 (kWh)                                                                                                                                             |\n| `CURRENT_ELECTRICITY_USAGE`              | True     | string | _'Net power usage'_           | Current net power used (zero during delivery) in kWatt                                                                                                                                             |\n| `CURRENT_ELECTRICITY_DELIVERY`           | True     | string | _'Net power delivery'_        | Current net power delivered (zero during import) in kWatt                                                                                                                                          |\n| `ELECTRICITY_ACTIVE_TARIFF`              | True     | string | _'Active tariff'_             | The active tarrif (low of normal) values can be customized in `dsmr` section                                                                                                                       |\n| `LONG_POWER_FAILURE_COUNT`               | True     | string | _'Long power failure count'_  | The number of 'long' power failures counted.                                                                                                                                                       |\n| `SHORT_POWER_FAILURE_COUNT`              | True     | string | _'Short power failure count'_ | The number of 'shorted' power failures counted.                                                                                                                                                    |\n| `VOLTAGE_SAG_L1_COUNT`                   | True     | string | _'Voltage sag count L1'_      | The number of power sags for fase L1 counted.                                                                                                                                                      |\n| `VOLTAGE_SWELL_L1_COUNT`                 | True     | string | _'Voltage swell count L1'_    | The number of power swells for fase L1 counted.                                                                                                                                                    |\n| `INSTANTANEOUS_ACTIVE_POWER_L1_POSITIVE` | True     | string | _'Net power usage L1'_        | Current net power used for fase L1 (zero during delivery) in Watt                                                                                                                                  |\n| `INSTANTANEOUS_ACTIVE_POWER_L1_NEGATIVE` | True     | string | _'Net power delivery L1'_     | Current net power delivered for fase L1 (zero during import) in Watt                                                                                                                               |\n| `current_net_power`                      | True     | string | _'Current net power'_         | The current net power (can be negative) in Watt                                                                                                                                                    |\n| `current_net_power_l1`                   | True     | string | _'Current net power L1'_      | The current net power for fase L1 (can be negative) in Watt                                                                                                                                        |\n| `INSTANTANEOUS_VOLTAGE_L1`               | True     | string | _'Net voltage L1'_            | The current net voltage in Volts for Fase L1 (rounded to an integer)                                                                                                                               |\n| `net_voltage_max`                        | True     | string | _'Net voltage max'_           | The current maximum net voltage in Volts over all fases (rounded to an integer). Can be used as `net_voltage_fallback` key to publish voltage to pvoutput when no solar voltage data is available. |\n| `INSTANTANEOUS_CURRENT_L1`               | True     | string | _'Net current L1 DSMR'_       | The current for fase L1 in Amp\u00e8re (rounded to a positive integer) directly from your smart meter.                                                                                                  |\n| `net_current_l1`                         | True     | string | _'Net current L1'_            | The current for fase L1 in Amp\u00e8re calculated using `current_net_power_l1` / `INSTANTANEOUS_VOLTAGE_L1`. This gives a more precise current. Value is negative during enery delivery.                |\n\n> The entries for fase L1 are also applicable for fase L2 and L3 if the data is available`\n\n##### DSMR gas data - entity name override\n\n| key                     | optional | type   | default                   | description                                                           |\n| ----------------------- | -------- | ------ | ------------------------- | --------------------------------------------------------------------- |\n| `timestamp_gas`         | True     | string | _'Last update gas meter'_ | Timestamp of the last gas meter data published.                       |\n| `gas_consumption_total` | True     | string | _'Gas total'_             | The total amount of m3 gas delivered since installation of the meter. |\n| `gas_consumption_hour`  | True     | string | _'Gas consumption'_       | The current consumption of gas in m3/hour.                            |\n\nThe unit of measurement the used icon, MQTT device_class and value template file can be customized by updating the file `data_fields.json`.\nMake a copy of the original file and configure the path under the `data_config` key in the general setting.\n\n### PVoutput plugin settings in the section `output.pvoutput` of `apps.yaml` or `config.yaml`\n\nRegister a free acount and API key at https://pvoutput.org/register.jsp\n\n| key                        | optional | type   | default  | description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |\n| -------------------------- | -------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `sys_id`                   | True     | string | _(none)_ | Your unique system id, generated when creating an account at pvoutput.org. Enable publishing combined inverter data to this system id. You can also set `sys_id` in plant specific section to publish separate inverters.                                                                                                                                                                                                                                                                                                                                                        |\n| `api_key`                  | False    | string | _(none)_ | Unique API access key generated at pvoutput.org                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| `use_temperature`          | True     | bool   | `false`  | When set to true and `use_inverter_temperature` is not set, the temperature is obtained from OpenWeatherMap is submitted to pvoutput.org when logging the data.                                                                                                                                                                                                                                                                                                                                                                                                                  |\n| `use_inverter_temperature` | True     | bool   | `false`  | When set to true and `use_temperature` is set, the inverter temperature is submitted to pvoutput.org when logging the data. Only the clients `tcpclient` and `localproxy` are supported.                                                                                                                                                                                                                                                                                                                                                                                         |\n| `publish_voltage`          | True     | string | _(none)_ | The _fieldname_ key of the voltage property to use for pvoutput 'addstatus' publishing. When set to `'voltage_ac_max'`, the maximal inverter AC voltage over all fases is submitted to pvoutput.org when logging the data. Only the clients `tcpclient` and `localproxy` are supported. Supported values are `voltage_ac1`, `voltage_ac2`, `voltage_ac3` or `voltage_ac_max` or one ofe the DSMR voltage fields (INSTANTANEOUS_VOLTAGE_L1 / \\_L2, \\_L3 or net_voltage_max) if DSMR is available. The field `net_voltage_max` holds the highest voltage over all available fases. |\n| `net_voltage_fallback `    | True     | string | _(none)_ | The _fieldname_ key of the voltage property to use for pvoutput 'addstatus' publishing in case no solar data is available during sun down. When set to `'net_voltage_max'`, the maximal net voltage over all fases is submitted as alternative to pvoutput.org. This key only makes sens when using the DSMR integration.                                                                                                                                                                                                                                                        |\n\n### CSVoutput plugin settings in the section `output.csvoutput` in of `apps.yaml` or `config.yaml`\n\n| key               | optional | type   | default  | description                                                                                                                               |\n| ----------------- | -------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------- |\n| `csvfile`         | True     | string | _(none)_ | Used by the client `csvoutput`. The file and path to append or create for csv logging.                                                    |\n| `separator`       | True     | string | _;_      | Used by the client `csvoutput`. The separator/delimiter to use between headers and fields. Use '\\t' to use a tab as separator.            |\n| `no_headers`      | True     | bool   | _False_  | Used by the client `csvoutput`. If `csvoutput` will not write headers to the `csvfile`.                                                   |\n| `fields`          | True     | list   | _[*]_    | Used by the client `csvoutput`. A list of fields to log. The fields `date` and `time` are specials fields to log the local date and time. |\n| `use_temperature` | True     | bool   | _False_  | When set to true the `temperature` field is set in the data set which can be logged. The value is obtained from OpenWeatherMap.           |\n\n#### Default fields and additional fields\n\nDefault fields assignment [*]:\n\n- `date`\n- `time`\n- `current_power`\n- `today_energy`\n- `total_energy`\n\nThe following additional fields are available if DSMR data can be matched with the aggregated solar data:\n\n- `energy_direct_use`\n- `energy_used_net`\n- `power_direct_use`\n- `power_consumption`\n- `last_update_calc`\n\n### InfluxDB plugin settings in the section `output.influxdb` in of `apps.yaml` or `config.yaml`\n\n| key               | optional | type    | default           | description                                                                  |\n| ----------------- | -------- | ------- | ----------------- | ---------------------------------------------------------------------------- |\n| `host`            | True     | string  | `localhost`       | Hostname or fqdn of the InfluxDB server for logging.                         |\n| `port`            | True     | integer | `8086`            | InfluxDB port to be used.                                                    |\n| `ssl`             | True     | bool    | `false`           | Use SSL. Set to `true` if the URL starts with `https://`                     |\n| `verify_ssl`      | True     | bool    | `true`            | By default a certificate is validated. Set to `false` to disable validation. |\n| `ssl_ca_cert`     | True     | string  | _(none)_          | Set an alternative CA cert. (InfluxDB 2.x client only)                       |\n| `org`             | True     | string  | _(none)_          | The InfluxDB2 organisation (InfluxDB 2.x only)                               |\n| `bucket`          | True     | string  | _(none)_          | The InfluxDB2 bucket to write to (InfluxDB 2.x only)                         |\n| `token`           | True     | string  | _(none)_          | The InfluxDB2 authentication token (InfluxDB 2.x only)                       |\n| `use_temperature` | True     | bool    | `false`           | When set to true the temperature is obtained from OpenWeatherMap and logged. |\n| `database`        | True     | string  | _omnikdatalogger_ | The InfluxDB database (InfluxDB 1.8x only)                                   |\n| `username`        | True     | string  | _(none)_          | The InfluxDB username used for Basic authentication (InfluxDB 1.8x only)     |\n| `password`        | True     | string  | _(none)_          | The InfluxDB password used for Basic authentication (InfluxDB 1.8x only)     |\n| `jwt_token`       | True     | string  | _(none)_          | The InfluxDB webtoken for JSON Web Token authentication (InfluxDB 1.8x only) |\n\nLogging to InfluxDB is supported with configuration settings from `data_fields.json` The file allows to customize measurement header and allows setting additional tags.\nWhen using InfluxDB2, authentication is mandantory. Configure `org`, `bucket` and `token` to enable the InfluxDB v2 client.\n\n#### OpenWeatherMap settings in the section `openweathermap` of `apps.yaml` or `config.yaml`\n\n_(used by *PVoutput* plugin if *use_temperature* is true and you did not specify `use__inverter_temperature`)_\n\nVisit https://openweathermap.org/price to obtain a (free) api key. The weather data is cached with een TTL of 300 seconds.\n\n| key        | optional | type   | default                  | description                                                            |\n| ---------- | -------- | ------ | ------------------------ | ---------------------------------------------------------------------- |\n| `api_key`  | False    | string | _(none)_                 | Unique access key generated at openweathermap.org                      |\n| `endpoint` | True     | string | `api.openweathermap.org` | FQDN of the API endpoint.                                              |\n| `lon`      | False    | float  | _(none)_                 | Longitude for the weather location                                     |\n| `lat`      | False    | float  | _(none)_                 | Latitude for the weather location                                      |\n| `units`    | True     | string | `metric`                 | Can be _metric_ (for deg. Celsius) or _imperial_ (for deg. Fahrenheit) |\n\n### Device attribute settings and relation with `data_fields.json`\n\nOver MQTT the MQTT output advertizes the data of inverter, DSMR data, DSMR gas data and combined data. These groups bound to device attributes that wil be associated withe entities that are being published.\nIn Home Assistant throug MQTT auto discovery this will show as seperate devices for 'Omnik' entities, 'DSMR' entities, 'DSMR gas' entities and 'DSMR_omnik' (combined) entities.\nAll fields are configured with the pre installed `data_fields.json` file. This file holds an `asset` property for each field which corresponds with the asset class.\nEach asset class must have one field with `\"dev_cla\": \"timestamp\"` which is the timestamp field for that class.\nIf you want to omit field in your output you can personalize `data_fields.json`. Do NOT customize the shared version of `data_fields.json` but make a copy and configure the aternative path\nusing the [`data_config` key in get general section](https://github.com/jbouwh/omnikdatalogger#general-settings-of-appsyaml-or-configini).\nThe `attributes` section allows to customize some asset class settings.\n\n| key                        | optional | type   | default                                                           | description                                                                                                                                                                                                                           |\n| -------------------------- | -------- | ------ | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `asset_classes`            | True     | list   | _omnik, omnik_dsmr, dsmr, dsmr_gas_                               | Access classes for device payload and grouping of entities.                                                                                                                                                                           |\n| `asset.{asset_class}`      | True     | string | _see below_                                                       | Customize attribute payload for an asset class                                                                                                                                                                                        |\n| `asset.omnik`              | True     | string | _inverter, plant_id, last_update_                                 | Standard attributes for published Omnik inverter data                                                                                                                                                                                 |\n| `asset.omnik_dsmr`         | True     | string | _inverter, plant_id, EQUIPMENT_IDENTIFIER, terminal, last_update_ | Standard attributes for published combined DSMR and Omnik inverter data                                                                                                                                                               |\n| `asset.dsmr                | True     | string | _EQUIPMENT_IDENTIFIER, terminal, timestamp_                       | Standard attributes for published DSMR data                                                                                                                                                                                           |\n| `asset.dsmr_gas`           | True     | string | _EQUIPMENT_IDENTIFIER_GAS, terminal, timestamp_gas_               | Standard attributes for published DSMR gas data                                                                                                                                                                                       |\n| `model.{asset_class}`      | True     | string | _see below_                                                       | Customize the model property of the device payload for an asset class                                                                                                                                                                 |\n| `model.omnik`              | True     | string | _Omniksol_                                                        | Customize the model property of the device payload for the asset class `omnik` (Solar data)                                                                                                                                           |\n| `model.omnik_dsmr`         | True     | string | _Omnik data logger_                                               | Customize the model property of the device payload for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                                      |\n| `model.dsmr`               | True     | string | _DSRM electricity meter_                                          | Customize the model property of the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                                 |\n| `model.dsmr_gas`           | True     | string | _DSRM gas meter_                                                  | Customize the model property of the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                                     |\n| `mf.{asset_class}`         | True     | string | _see below_                                                       | Customize the manufacturer property of the device payload for an asset class                                                                                                                                                          |\n| `mf.omnik`                 | True     | string | _Omnik_                                                           | Customize the manufacturer property of the device payload for the asset class `omnik` (Solar data)                                                                                                                                    |\n| `mf.omnik_dsmr`            | True     | string | _JBsoft_                                                          | Customize the manufacturer property of the device payload for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                               |\n| `mf.dsmr`                  | True     | string | _Netbeheer Nederland_                                             | Customize the manufacturer property of the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                          |\n| `mf.dsmr_gas`              | True     | string | _Netbeheer Nederland_                                             | Customize mthe anufacturer property of the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                              |\n| `identifier.{asset_class}` | True     | string | _see below_                                                       | Customize the identifier property of the device payload for an asset class. This property should be unique when using a configuration with more DSMR meters or plants The identifier will have the format {asset*class}*{identifier}. |\n| `identifier.omnik`         | True     | string | _plant_id_                                                        | Customize the identifier property of the device payload for the asset class `omnik` (Solar data)                                                                                                                                      |\n| `identifier.omnik_dsmr`    | True     | string | _plant_id_                                                        | Customize the identifier property of the device payload for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                                 |\n| `identifier.dsmr`          | True     | string | _EQUIPMENT_IDENTIFIER_                                            | Customize the identifier property of the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                            |\n| `identifier.dsmr_gas`      | True     | string | _EQUIPMENT_IDENTIFIER_GAS_                                        | Customize the property of the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                                           |\n| `devicename.{asset_class}` | True     | string | _see below_                                                       | Customize the device name for an asset class. This attribute replaces the previous decrepated `device_name` setting in the `output.mqtt` section.                                                                                     |\n| `devicename.omnik`         | True     | string | _Inverter_                                                        | Customize the device name for the asset class `omnik` (Solar data)                                                                                                                                                                    |\n| `devicename.omnik_dsmr`    | True     | string | _Omnik_data_logger_                                               | Customize the device name for the asset class `omnik_dsmr` (DSMR + Solar combined data)                                                                                                                                               |\n| `devicename.dsmr`          | True     | string | _DSMR_electicity_meter_                                           | Customize the device name the device payload for the asset class `dsmr` (DSMR electricity data)                                                                                                                                       |\n| `devicename.dsmr_gas`      | True     | string | _DSMR_gasmeter_                                                   | Customize the device name the device payload for the asset class `dsmr_gas` (DSMR gas data)                                                                                                                                           |\n\n## Configuration using config.ini\n\nUsing a `config.ini` config file is no longer supported! Move your config a .yaml file in stead.\n\n## Scheduled Run (commandline or using systemd)\n\nYou've got your default options to schedule this logger, but I included a `systemd` service file to run this as a service on Linux.\n\n> **PS**: I'm using `Ubuntu 18.04 LTS` but Debian buster should also work.\n\nFirst, install this thing (~ using Python 3.7+ !!!)\n\n> If you don't have `Python3.7+` installed, do that first (~ don't forget to install `python3-pip` as well)\n\n```\n#### Create a to download the scripts\n$ git clone https://github.com/jbouwh/omnikdatalogger\n> onmiklogger.py can be found in the `./apps` folder\n# check if properly installed\n$ omniklogger.py -h\nusage: omniklogger.py [-h] [--settings FILE] [--interval n] [-l]\n\noptional arguments:\n  -h, --help     show this help message and exit\n  --settings FILE  Path to yaml configuration file\n  --interval n   Execute every n seconds\n  -l {DEBUG,INFO,WARNING,ERROR}, --loglevel {DEBUG,INFO,WARNING,ERROR} Loglevel\n```\n\nAn example systemd script is available from `scripts/omnikdatalogger.service`. Copy it so you can customize it to your use.\n\nCheck the folowing line in this file in the script.\n\n```\nExecStart=/usr/bin/python3 /usr/local/bin/omniklogger.py --settings /etc/omnik/config.yaml --interval 360\n```\n\nMake sure the interval is as desired and that the path of omniklogger.py is correct\n\nThen copy the modified script path to `/lib/systemd/system/omnik-data-logger.service`\n\nNext, enable and start service:\n\n```\n$ systemd enable omnikdatalogger\nCreated symlink /etc/systemd/system/multi-user.target.wants/omnikdatalogger.service \u2192 /lib/systemd/system/omnikdatalogger.service.\n$ systemd start omnikdatalogger\n```\n\nCheck if `omnikdatalogger.service` is running correctly:\n\n```\n$ systemd status omnikdatalogger\n\u25cf omnikdatalogger.service - Omnik Data Logger service\n   Loaded: loaded (/lib/systemd/system/omnikdatalogger.service; enabled; vendor preset: enabled)\n   Active: active (running) since Tue 2019-06-18 06:55:08 UTC; 4min 36s ago\n Main PID: 2445 (python3)\n    Tasks: 2 (limit: 4915)\n   CGroup: /system.slice/omnikdatalogger.service\n           \u2514\u25002445 /usr/bin/python3 /usr/local/bin/omniklogger.py --settings /etc/omnik/config.yaml --interval 300\n```\n",
    "bugtrack_url": null,
    "license": "gpl-3.0",
    "summary": "Omnik Data Logger",
    "version": "1.14.3",
    "project_urls": {
        "Homepage": "https://github.com/jbouwh/omnikdatalogger"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0145b81079d66b68bf24746d15c67ecb9079ff81333063e345e5ed60696a773e",
                "md5": "c659c88833f50ed405d91821e034e266",
                "sha256": "63e0ecdfd502a51db0bddd7ae3abd0f3f0636e3cc70d0f2b12797e6fcddd1714"
            },
            "downloads": -1,
            "filename": "omnikdatalogger-1.14.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c659c88833f50ed405d91821e034e266",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 78772,
            "upload_time": "2024-03-22T23:41:01",
            "upload_time_iso_8601": "2024-03-22T23:41:01.895589Z",
            "url": "https://files.pythonhosted.org/packages/01/45/b81079d66b68bf24746d15c67ecb9079ff81333063e345e5ed60696a773e/omnikdatalogger-1.14.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d75e18f6b0ac15701646b7be4b3af3a166778af3f16f1468f59ed456021894eb",
                "md5": "26f9d700312933a6c75f0b0505944015",
                "sha256": "c892e1b7b4b610ad62a69f46a3ad3c4e225698d28e20998995dc4019e53dcab6"
            },
            "downloads": -1,
            "filename": "omnikdatalogger-1.14.3.tar.gz",
            "has_sig": false,
            "md5_digest": "26f9d700312933a6c75f0b0505944015",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 97778,
            "upload_time": "2024-03-22T23:41:04",
            "upload_time_iso_8601": "2024-03-22T23:41:04.721606Z",
            "url": "https://files.pythonhosted.org/packages/d7/5e/18f6b0ac15701646b7be4b3af3a166778af3f16f1468f59ed456021894eb/omnikdatalogger-1.14.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-22 23:41:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jbouwh",
    "github_project": "omnikdatalogger",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "configparser",
            "specs": [
                [
                    ">=",
                    "3.7.4"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.21.0"
                ]
            ]
        },
        {
            "name": "cachetools",
            "specs": [
                [
                    ">=",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "pytz",
            "specs": [
                [
                    ">=",
                    "2019.3"
                ]
            ]
        },
        {
            "name": "paho-mqtt",
            "specs": [
                [
                    "==",
                    "1.6.1"
                ]
            ]
        },
        {
            "name": "dsmr-parser",
            "specs": [
                [
                    ">=",
                    "0.21"
                ]
            ]
        },
        {
            "name": "astral",
            "specs": [
                [
                    ">=",
                    "1.10.1"
                ]
            ]
        },
        {
            "name": "influxdb-client",
            "specs": [
                [
                    ">=",
                    "1.26"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    ">=",
                    "5.1"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "omnikdatalogger"
}
        
Elapsed time: 0.22811s