Package: omnikdataloggerproxy
OMNIKDATALOGGERPROXYTheomnikdataloggerproxy.pyscript 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 withomnikdataloggerfor output to pvoutput, mqtt, influxdb and integration with Home Assistant.Install using pipsudo pip3 install omnikdataloggerproxyThe supporting files are installed at the folder/usr/local/share/omnikdataloggerproxy/Command lineusage: omnikloggerproxy.py [-h] --serialnumber SERIALNUMBER [SERIALNUMBER ...]
                           [--settings 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]
                           [--mqtt_tls MQTT_TLS]
                           [--mqtt_ca_certs MQTT_CA_CERTS]
                           [--mqtt_client_cert MQTT_CLIENT_CERT]
                           [--mqtt_client_key MQTT_CLIENT_KEY]Configuration fileThe proxy parameters will fallback to theconfig.yamlin under keyomnikdatalogger->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 is decrepated and config.yaml replaces config.ini.omnikdatalogger:proxy:serialnumber:-serial1232323......keyoptionaltypedefaultdescriptionserialnumberFalselist[]List of serialnumbers of the inverters supportedloglevelTruestringINFOThe basic loglevel [DEBUG, INFO, WARNING, ERROR, CRITICAL]listenaddressTruestring127.0.0.1A local available address to listen tolistenportTrueint10004The local port to listen toomnikloggerTruestringNoneForward to an address omnik/SolarmanPV datalogger server listens to. Set this to176.58.117.69as final forwarder.listenportTrueint10004The port the omnik/SolarmanPV datalogger server listens to.You can use the mqtt based client of omnikdataloggerlocalproxy.hassapi. You need to specifymqtt_hostto activate this feature and specify all needed attributes.Config file settings will overrule the command line settings. The MQTT parameters will fallback to the settings in the sectionoutput.mqtt:. Specify a config file using the --settings (or --config) option.
For details see theOmnik Data Logger README.mdThere are example config files included:config.yaml_example.txtconfig.ini_example.txt.MQTT configurationOmnikdatalogger 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 keyomnikdatalogger->proxy.omnikdatalogger:......mqtt:discovery_prefix:homeassistant......keyoptionaltypedefaultdescriptiondiscovery_prefixTruestring'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_nameTruestring'Datalogger proxy'Omnik data logger proxy only setting. Overrides the name of the datalogger.logger_sensor_nameTruestring'Datalogger'Omnik data logger proxy only setting. Overrides the name of the datalogger datalogger sensor entity.append_plant_idTrueboolFalseWhen a device_name is specified the plant id can be added to the name te be able to identify the plant.hostTruestringlocalhostHostname or fqdn of the MQTT server for publishing.portTrueinteger1883MQTT port to be used.retainTrueboolTrueRetains the data send to the MQTT serviceclient_name_prefixTruestring'ha-mqtt-omniklogger'Defines a prefix that is used as client name. A 4 byte uuid is added to ensure an unique ID.usernameFalsestring(none)The MQTT username used for authenticationpasswordFalsestring(none)The MQTT password used for authenticationtlsTrueboolFalseSecures the connection to the MQTT service, the MQTT server side needs a valid certificateca_certsTruestring(none)File path to a file containing alternative CA's. If not configure the systems default CA is usedclient_certTruestring(none)File path to a file containing a PEM encoded client certificateclient_keyTruestring(none)File path to a file containing a PEM encoded client private keyUsing DockerRun the docker containerThe 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.The following command will pull theDockerimage, mount theconfig.yaml(in the root of the container) and create theDockercontainer.$ docker run --name omnikdataloggerproxy -d -v ${PWD}/config.yaml:/config.yaml -p 10004:10004 --name omnikdataloggerproxy --restart unless-stopped jbouwh/omnikdataloggerproxy:latestI also added adocker-compose.ymlthat can be used. Run it at the folder where yourconfig.yamlfile resites. It is still possible to useconfig.inifiles as well. This option is decrepated now.So, doing exactly the same ... but usingdocker-compose:$ docker-compose -f /path/to/docker-compose.yml up -dPrearing to run omnikdataloggerproxy.py script (manual install)Make sure you have shell access (ssh or telnet).Install pip:curl -k https://bootstrap.pypa.io/get-pip.py | python3See: (https://stackoverflow.com/questions/47649902/installing-pip-on-a-dsm-synology)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 playOn 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 omnikloggerproxy.py script, the bash script (omnikproxy_example_startup.sh) andconfig.ini_example.txtto a folder that will not be affected by upgrades. E.g./volume1/someshare/yourscriptfolder.Renameconfig.ini_example.txttoconfig.iniand 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 for176.58.117.69/32to your synology.Configure MQTT to forward the data to be able to use the localproxy plugin withhassapiormqtt_proxy.You 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.Running omnikdataloggerproxy as a service on a Debian based systemYou can find the following sample service config at/usr/local/share/omnikdataloggerproxy/omnikdatalogggerproxy.serviceafter installingpip3 install omnikdataloggerproxyas root.[Unit]Description=Omnik datalogger proxyAfter=network.target[Service]Type=simpleExecStart=/usr/local/bin/omnikloggerproxy.py --serialnumber NLDN123456789012 --listenaddress 0.0.0.0 --omniklogger 176.58.117.69 --omnikloggerport 10004User=omnikGroup=usersRestart=on-failureRestartSec=30s[Install]WantedBy=multi-user.targetThe 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 omnikdataloggerproxycp /usr/local/share/omnikdataloggerproxy/omnikdatalogggerproxy.config .UpdateUserandserialnumberin the scriptomnikdatalogggerproxy.configusing your favorite editor.nano omnikdatalogggerproxy.configLink the script to systemd: toln -s /etc/omnikdataloggerproxy/omnikdatalogggerproxy.service /etc/systemd/system/omnikdatalogggerproxy.serviceEnable the service:systemctl enable omnikdatalogggerproxyStart the service:systemctl start omnikdatalogggerproxycheck if the service is running:systemctl status omnikdatalogggerproxyAfter 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/omnikloggerproxy.py --serialnumber NLDN123456789012 --listenaddress 0.0.0.0 --omniklogger 176.58.117.69 --omnikloggerport 10004

Jun 21 13:33:22 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.
Jun 21 13:38:33 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'
Jun 21 13:38:33 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: 2020-06-21 13:38:33.795477 Forwarding to omnik logger "176.58.117.69"
Jun 21 13:38:33 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.
Jun 21 13:43:38 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'
Jun 21 13:43:38 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: 2020-06-21 13:43:38.937148 Forwarding to omnik logger "176.58.117.69"
Jun 21 13:43:38 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.
Jun 21 13:48:50 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Processing message for inverter 'NLDN123456789012'
Jun 21 13:48:50 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: 2020-06-21 13:48:50.194599 Forwarding to omnik logger "176.58.117.69"
Jun 21 13:48:50 alpha omnikloggerproxy.py[28182]: omnikloggerproxy: Forwarding succesful.The log shows when messages were forwarded.