{"id":14985299,"url":"https://github.com/jbouwh/omnikdataloggerproxy","last_synced_at":"2025-07-14T20:31:34.940Z","repository":{"id":57448596,"uuid":"369327713","full_name":"jbouwh/omnikdataloggerproxy","owner":"jbouwh","description":"Proxy script to forward Omnik inverter messages to omnikdatalogger","archived":false,"fork":false,"pushed_at":"2021-10-27T13:48:07.000Z","size":95,"stargazers_count":0,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-29T20:17:42.246Z","etag":null,"topics":["datalogger","home-assistant","iot","mqtt","omnik","pvoutput","solar-energy","solarmanpv"],"latest_commit_sha":null,"homepage":"https://jbsoft.nl/site/nl/omnik-datalogger/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jbouwh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-20T20:15:25.000Z","updated_at":"2021-10-27T13:46:35.000Z","dependencies_parsed_at":"2022-09-16T14:00:19.288Z","dependency_job_id":null,"html_url":"https://github.com/jbouwh/omnikdataloggerproxy","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/jbouwh/omnikdataloggerproxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbouwh%2Fomnikdataloggerproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbouwh%2Fomnikdataloggerproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbouwh%2Fomnikdataloggerproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbouwh%2Fomnikdataloggerproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jbouwh","download_url":"https://codeload.github.com/jbouwh/omnikdataloggerproxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jbouwh%2Fomnikdataloggerproxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265344831,"owners_count":23750566,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["datalogger","home-assistant","iot","mqtt","omnik","pvoutput","solar-energy","solarmanpv"],"created_at":"2024-09-24T14:10:40.508Z","updated_at":"2025-07-14T20:31:34.670Z","avatar_url":"https://github.com/jbouwh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OMNIKDATALOGGERPROXY\n![omnikdatalogger](https://github.com/jbouwh/omnikdatalogger/workflows/omnikdatalogger/badge.svg)\n![PyPI version](https://badge.fury.io/py/omnikdataloggerproxy.svg) \n\nThe `omnikdataloggerproxy.py` 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.\nGood luck with them.\nThe output can be processed with [omnikdatalogger](https://github.com/jbouwh/omnikdatalogger) for output to pvoutput, mqtt, influxdb and integration with Home Assistant.\n\n## Install using pip\n`sudo pip3 install omnikdataloggerproxy`\n\nThe supporting files are installed at the folder */usr/local/share/omnikdataloggerproxy/*\n\n### Command line\n```\nusage: omnikloggerproxy.py [-h] --serialnumber SERIALNUMBER [SERIALNUMBER ...]\n                           [--settings FILE  Path to .yaml configuration file]\n                           [--section  Section to .yaml configuration file to use. Defaults to the first section found.]\n                           [--config FILE  Path to configuration file (ini) (DECREPATED!)]\n                           [--loglevel LOGLEVEL]\n                           [--listenaddress LISTENADDRESS]\n                           [--listenport LISTENPORT]\n                           [--omniklogger OMNIKLOGGER]\n                           [--omnikloggerport OMNIKLOGGERPORT]\n                           [--mqtt_host MQTT_HOST] [--mqtt_port MQTT_PORT]\n                           [--mqtt_retain MQTT_RETAIN]\n                           [--mqtt_discovery_prefix MQTT_DISCOVERY_PREFIX]\n                           [--mqtt_client_name_prefix MQTT_CLIENT_NAME_PREFIX]\n                           [--mqtt_username MQTT_USERNAME]\n                           [--mqtt_password MQTT_PASSWORD]\n                           [--mqtt_device_name MQTT_DEVICE_NAME]\n                           [--mqtt_logger_sensor_name MQTT_LOGGER_SENSOR_NAME]\n                           [--mqtt_tls MQTT_TLS]\n                           [--mqtt_ca_certs MQTT_CA_CERTS]\n                           [--mqtt_client_cert MQTT_CLIENT_CERT]\n                           [--mqtt_client_key MQTT_CLIENT_KEY]\n```\n### Configuration file\nThe proxy parameters will fallback to the `config.yaml` in under key `omnikdatalogger-\u003eproxy`. Specify a configfile using the --config option.\nThis way it easier tot run omnikdatalogger proxy as a docker container.\n\u003e NOTE: The use of config.ini will is decrepated and config.yaml replaces config.ini.\n\n```yaml\nomnikdatalogger:\n  proxy:\n    serialnumber:\n    - serial1232323\n    ...\n    ...\n```\n\nkey | optional | type | default | description\n-- | --| -- | -- | --\n`serialnumber` | False | list | [] | List of serialnumbers of the inverters supported\n`loglevel` | True | string | `INFO` | The basic loglevel [DEBUG, INFO, WARNING, ERROR, CRITICAL]\n`listenaddress` | True | string | `127.0.0.1` | A local available address to listen to\n`listenport` | True | int | `10004` | The local port to listen to\n`omniklogger` | True | string | _None_ | Forward to an address omnik/SolarmanPV datalogger server listens to. Set this to `176.58.117.69` as final forwarder.\n`listenport` | True | int | `10004` | The port the omnik/SolarmanPV datalogger server listens to.\n\nYou can use the mqtt based client of omnikdatalogger `localproxy.hassapi`. You need to specify `mqtt_host` to activate this feature and specify all needed attributes.\n\nConfig 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.\nFor details see the [Omnik Data Logger README.md](https://github.com/jbouwh/omnikdatalogger#mqtt_proxy-plugin-for-the-localproxy-client-in-the-section-clientlocalproxymqtt_proxy-of-appsyaml-or-configini)\n\nThere are example config files included:\n- [`config.yaml_example.txt`](https://github.com/jbouwh/omnikdataloggerproxy/blob/main/config.yaml_example.txt)\n- [`config.ini_example.txt`](https://github.com/jbouwh/omnikdataloggerproxy/blob/main/config.ini_example.txt).\n\n#### MQTT configuration\nOmnikdatalogger proxy supports forwarding using MQTT. The Omnikdatalogger mqtt_proxy and hassapi plugin (localproxy client) can use the data published by Omnikdataloggerproxy. The MQTT can also be read from the config.yaml file under key `omnikdatalogger-\u003eproxy`.\n\n```yaml\nomnikdatalogger:\n    ...\n    ...\n  mqtt:\n    discovery_prefix: homeassistant\n    ...\n    ...    \n```\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.                                                                                      |\n| `logger_sensor_name` | True     | string  | _'Datalogger'_          | Omnik data logger proxy only setting. Overrides the name of the datalogger datalogger sensor entity.                                                             |\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\n## Using Docker\n\n### Run the docker container\n\nThe config files for omnikdataloggerproxy in the container will be will /config/config.yaml (settings), or if you would like to use the config.ini /config/config.ini. \n\nThe following command will pull the `Docker` image, mount the `config.yaml` (in the root of the container) and create the `Docker` container.\n\n```\n$ docker run --name omnikdataloggerproxy -d -v ${PWD}/config.yaml:/config.yaml -p 10004:10004 --name omnikdataloggerproxy --restart unless-stopped jbouwh/omnikdataloggerproxy:latest\n```\n\nI also added a `docker-compose.yml` that can be used. Run it at the folder where your `config.yaml` file resites. It is still possible to use `config.ini` files as well. This option is decrepated now.\n\nSo, doing exactly the same ... but using `docker-compose`:\n\n```\n$ docker-compose -f /path/to/docker-compose.yml up -d\n```\n\n\n## Prearing to run omnikdataloggerproxy.py script (manual install)\n\n* Make sure you have shell access (ssh or telnet).\n* Install pip: `curl -k https://bootstrap.pypa.io/get-pip.py | python3` See: (https://stackoverflow.com/questions/47649902/installing-pip-on-a-dsm-synology)\n* Install the paho mqtt client: `/volume1/@appstore/py3k/usr/local/bin/pip3 install paho-mqtt`. The path may be diferent. I used a Synology DS218 play\n\nOn upgrades it might be necessary to reinstall pip and paho-mqtt. Make sure you chack on this after an update for your Synology.\n\nNow take the following steps:\n* Place the omnikloggerproxy.py script, the bash script (omnikproxy_example_startup.sh) and `config.ini_example.txt` to a folder that will not be affected by upgrades. E.g. `/volume1/someshare/yourscriptfolder`.\n* Rename `config.ini_example.txt` to `config.ini` and configure settings.\n* check the commandline settings in the shell script.\n* 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)\n* The lines to configure iptables should run as root. The omnikproxylogger script works at userlevel too.\n* On your internet router/gateway, set up a static route for `176.58.117.69/32` to your synology.\n* Configure MQTT to forward the data to be able to use the localproxy plugin with `hassapi` or `mqtt_proxy`.\n\nYou can forward the logger trafic to the omnik servers, but if you rerouted yhe traffic for 176.58.117.69 you need to forward to a linux server elswere in the internet.\n\n## Running omnikdataloggerproxy as a service on a Debian based system\n\nYou can find the following sample service config at `/usr/local/share/omnikdataloggerproxy/omnikdatalogggerproxy.service` after installing `pip3 install omnikdataloggerproxy` as root.\n\n```ini\n[Unit]\nDescription=Omnik datalogger proxy\nAfter=network.target\n[Service]\nType=simple\nExecStart=/usr/local/bin/omnikloggerproxy.py --serialnumber NLDN123456789012 --listenaddress 0.0.0.0 --omniklogger 176.58.117.69 --omnikloggerport 10004\nUser=omnik\nGroup=users\nRestart=on-failure\nRestartSec=30s\n[Install]\nWantedBy=multi-user.target\n```\nThe template service file shows a forwarding only setup.\n\nTo setup omnikdatalogger proxy as root do:\n- Create a config folder and copy the sample service script:\n  - `cd /etc/`\n  - `mkdir omnikdataloggerproxy`\n  - `cp /usr/local/share/omnikdataloggerproxy/omnikdatalogggerproxy.config .`\n- Update `User` and *serialnumber* in the script `omnikdatalogggerproxy.config` using your favorite editor.\n  - `nano omnikdatalogggerproxy.config`\n- Link the script to systemd: to `ln -s /etc/omnikdataloggerproxy/omnikdatalogggerproxy.service /etc/systemd/system/omnikdatalogggerproxy.service`\n- Enable the service: `systemctl enable omnikdatalogggerproxy`\n- Start the service: `systemctl start omnikdatalogggerproxy`\n- check if the service is running: `systemctl status omnikdatalogggerproxy`\n\nAfter some time the logging should show something similar like this:\n```\n# systemctl status omnikdataloggerproxy\n● omnikdataloggerproxy.service - Omnik datalogger proxy\n   Loaded: loaded (/etc/omnikdataloggerproxy/omnikdataloggerproxy.service; enabled; vendor preset: enabled)\n   Active: active (running) since Sun 2020-06-21 13:33:21 CEST; 16min ago\n Main PID: 28182 (omnikloggerprox)\n    Tasks: 4 (limit: 4915)\n   Memory: 9.8M\n   CGroup: /system.slice/omnikdataloggerproxy.service\n           └─28182 /usr/bin/python3 /usr/local/bin/omnikloggerproxy.py --serialnumber NLDN123456789012 --listenaddress 0.0.0.0 --omniklogger 176.58.117.69 --omnikloggerport 10004\n\nJun 21 13:33:22 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.\nJun 21 13:38:33 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'\nJun 21 13:38:33 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: 2020-06-21 13:38:33.795477 Forwarding to omnik logger \"176.58.117.69\"\nJun 21 13:38:33 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.\nJun 21 13:43:38 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'\nJun 21 13:43:38 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: 2020-06-21 13:43:38.937148 Forwarding to omnik logger \"176.58.117.69\"\nJun 21 13:43:38 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.\nJun 21 13:48:50 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'\nJun 21 13:48:50 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: 2020-06-21 13:48:50.194599 Forwarding to omnik logger \"176.58.117.69\"\nJun 21 13:48:50 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.\n```\nThe log shows when messages were forwarded.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbouwh%2Fomnikdataloggerproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjbouwh%2Fomnikdataloggerproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjbouwh%2Fomnikdataloggerproxy/lists"}