Skip to main content

Omnik Data Logger Proxy

Project description


omnikdatalogger PyPI version

The script and supporting files can be used intercept your inverters data messages. See the comments in the example shell script enand the config.ini example about how to use them. Good luck with them. The output can be processed with omnikdatalogger for output to pvoutput, mqtt, influxdb and integration with Home Assistant.

Install using pip

sudo pip3 install omnikdataloggerproxy

The supporting files are installed at the folder /usr/local/share/omnikdataloggerproxy/

Command line

usage: [-h] --serialnumber SERIALNUMBER [SERIALNUMBER ...]
                           [--config FILE  Path to .yaml configuration file]
                           [--section  Section to .yaml configuration file to use. Defaults to the first section found.]
                           [--config FILE  Path to configuration file (ini) (DECREPATED!)]
                           [--loglevel LOGLEVEL]
                           [--listenaddress LISTENADDRESS]
                           [--listenport LISTENPORT]
                           [--omniklogger OMNIKLOGGER]
                           [--omnikloggerport OMNIKLOGGERPORT]
                           [--mqtt_host MQTT_HOST] [--mqtt_port MQTT_PORT]
                           [--mqtt_retain MQTT_RETAIN]
                           [--mqtt_discovery_prefix MQTT_DISCOVERY_PREFIX]
                           [--mqtt_client_name_prefix MQTT_CLIENT_NAME_PREFIX]
                           [--mqtt_username MQTT_USERNAME]
                           [--mqtt_password MQTT_PASSWORD]
                           [--mqtt_device_name MQTT_DEVICE_NAME]
                           [--mqtt_logger_sensor_name MQTT_LOGGER_SENSOR_NAME]

Configuration file

The proxy parameters will fallback to the config.ini in the section [proxy]. Specify a configfile using the --config option. This way it easier tot run omnikdatalogger proxy as a docker container.

NOTE: The use of config.ini will be decrepated and config.yaml replaces config.ini.

key optional type default description
serialnumber False list [] List of serialnumbers of the inverters supported
loglevel True string INFO The basic loglevel [DEBUG, INFO, WARNING, ERROR, CRITICAL]
listenaddress True string A local available address to listen to
listenport True int 10004 The local port to listen to
omniklogger True string Forward to an address omnik/SolarmanPV datalogger server listens to. Set this to as final forwarder.
listenport True int 10004 The port the omnik/SolarmanPV datalogger server listens to.

Comfig file settings will overrule the command line settings. The MQTT parameters will fallback to the settings in the section output.mqtt:. Specify a config file using the --settings (or --config) option. For details see the Omnik Data Logger

There are example config files included:

Using Docker

This directory contains all artefacts to run the omnikdataloggerproxy as a Docker container.

You can use the included Makefile to build and push the Docker image yourself.

$ make help
help                           This help.
build                          Build the Docker image. Use IMAGE_TAG to specify tag (default:latest)
push                           Tag and push to Docker Hub
login                          Login to Docker Hub

PS: this is already advanced use ... I already build and pushed the image to Docker Hub.

Run the docker container

The following command will pull the Docker image, mount the config.ini and create the Docker container.

$ docker run --name omnikdataloggerproxy -d -v ${PWD}/config.ini:/config.ini -p 10004:10004 --name omnikdataloggerproxy jbouwh/omnikdataloggerproxy:latest

I also added a docker-compose.yml that can be used. Run it at the folder where your config.ini file resites.

So, doing exactly the same ... but using docker-compose:

$ docker-compose -f /path/to/docker-compose.yml up -d

Prearing to run script (manual install)

On upgrades it might be necessary to reinstall pip and paho-mqtt. Make sure you chack on this after an update for your Synology.

Now take the following steps:

  • Place the script, the bash script ( and config.ini_example.txt to a folder that will not be affected by upgrades. E.g. /volume1/someshare/yourscriptfolder.
  • Rename config.ini_example.txt to config.ini and configure settings.
  • check the commandline settings in the shell script.
  • Try to execute the script to test if it is working. (You can use task plannel later to start the script at boot automatically as activated task)
  • The lines to configure iptables should run as root. The omnikproxylogger script works at userlevel too.
  • On your internet router/gateway, set up a static route for to your synology.
  • Configure MQTT to forward the data to be able to use the localproxy plugin with hassapi or mqtt_proxy.

You can forward the logger trafic to the omnik servers, but if you rerouted yhe traffic for you need to forward to a linux server elswere in the internet.

Running omnikdataloggerproxy as a service on a Debian based system

You can find the following sample config at /usr/local/share/omnikdataloggerproxy/omnikdatalogggerproxy.config after installing pip3 install omnikdataloggerproxy as root.

Description=Omnik datalogger proxy
ExecStart=/usr/local/bin/ --serialnumber NLDN123456789012 --listenaddress --omniklogger --omnikloggerport 10004

The template service file shows a forwarding only setup.

To setup omnikdatalogger proxy as root do:

  • Create a config folder and copy the sample service script:
    • cd /etc/
    • mkdir omnikdataloggerproxy
    • cp /usr/local/share/omnikdataloggerproxy/omnikdatalogggerproxy.config .
  • Update User and serialnumber in the script omnikdatalogggerproxy.config using your favorite editor.
    • nano omnikdatalogggerproxy.config
  • Link the script to systemd: to ln -s /etc/omnikdataloggerproxy/omnikdatalogggerproxy.service /etc/systemd/system/omnikdatalogggerproxy.service
  • Enable the service: systemctl enable omnikdatalogggerproxy
  • Start the service: systemctl start omnikdatalogggerproxy
  • check if the service is running: systemctl status omnikdatalogggerproxy

After some time the logging should show something similar like this:

# systemctl status omnikdataloggerproxy
● omnikdataloggerproxy.service - Omnik datalogger proxy
   Loaded: loaded (/etc/omnikdataloggerproxy/omnikdataloggerproxy.service; enabled; vendor preset: enabled)
   Active: active (running) since Sun 2020-06-21 13:33:21 CEST; 16min ago
 Main PID: 28182 (omnikloggerprox)
    Tasks: 4 (limit: 4915)
   Memory: 9.8M
   CGroup: /system.slice/omnikdataloggerproxy.service
           └─28182 /usr/bin/python3 /usr/local/bin/ --serialnumber NLDN123456789012 --listenaddress --omniklogger --omnikloggerport 10004

Jun 21 13:33:22 alpha[28182]: omnikloggerproxy: Forwarding succesful.
Jun 21 13:38:33 alpha[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'
Jun 21 13:38:33 alpha[28182]: omnikloggerproxy: 2020-06-21 13:38:33.795477 Forwarding to omnik logger ""
Jun 21 13:38:33 alpha[28182]: omnikloggerproxy: Forwarding succesful.
Jun 21 13:43:38 alpha[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'
Jun 21 13:43:38 alpha[28182]: omnikloggerproxy: 2020-06-21 13:43:38.937148 Forwarding to omnik logger ""
Jun 21 13:43:38 alpha[28182]: omnikloggerproxy: Forwarding succesful.
Jun 21 13:48:50 alpha[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'
Jun 21 13:48:50 alpha[28182]: omnikloggerproxy: 2020-06-21 13:48:50.194599 Forwarding to omnik logger ""
Jun 21 13:48:50 alpha[28182]: omnikloggerproxy: Forwarding succesful.

The log shows when messages were forwarded.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for omnikdataloggerproxy, version 1.2.4
Filename, size File type Python version Upload date Hashes
Filename, size omnikdataloggerproxy-1.2.4-py3-none-any.whl (13.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size omnikdataloggerproxy-1.2.4.tar.gz (11.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page