Skip to content

Install using docker

Jan Bouwhuis edited this page May 21, 2021 · 4 revisions

Docker images can now be build from the docker folder. There is now a prepared image on docker hub.

Use the command docker pull jbouwh/omnikdatalogger:latest to pull the latest image.

To build image yourself:

git clone https://github.com/jbouwh/omnikdatalogger
cd omnikdatalogger
docker build --tag jbouwh/omnikdatalogger:latest .

Running the image

In the following example assumed is that the config file outside the container is at /home/pi/.omnik/config.yaml (user pi). In the docker image the user is omnik and the default location for the configuration inside the container is at /config.yaml

Note that within the container the config files will be in /config by default. You can either map config files individually or map the /config folder (advised).

By default the following parameters applied when the image is executed:

  • --settings /config/config.yaml
  • --config /config/config.ini
  • --persistant_cache_file /config/persistant_cache.json

A valid settings config or config file is mandatory. The persistant_cache_file will be automatically generated if not mapped outside the container. If you want to customize data_fields.json then set the location to /config/data_fields.json using the persistant_cache_file setting in your config file. The default location within the container wil be at /home/omnik/data_fields.json.

The -p option is only needed when the localproxy client is used with the tcp_proxy plugin.

Use --device option to give direct access to a DSMR compliant USB monitoring cable. Alternatively use ser2net.

Run image in the background using the following command:

docker run -d -v /home/pi/.omnik/config.yaml:/config/config.yaml -p 10004:10004 --restart unless-stopped --device /dev/ttyUSB0 --name omnikdatalogger jbouwh/omnikdatalogger:latest

The use of a config.ini is decrepated, but you can still use config.ini to setup the container.

Omnik data logger proxy

omnikdataloggerproxy can also be installed using Docker. All needed files are in the repository at: https://github.com/jbouwh/omnikdatalogger/tree/master/scripts/proxy.

Use the command docker pull jbouwh/omnikdataloggerproxy:latest to pull the latest image.

To build image yourself:

git clone https://github.com/jbouwh/omnikdatalogger
cd omnikdatalogger/scripts/proxy
docker build --tag jbouwh/omnikdataloggerproxy:latest .

Running the image

In the following example assumed is that the config file outside the container is at /home/pi/.omnik/config.ini (user pi). In the docker image the user is omnik and the default location for the configuration inside the container is at /config.ini

The -p option is only needed when the localproxy client is used with the tcp_proxy plugin.

Use --device option to give direct access to a DSMR compliant USB monitoring cable. Alternatively use ser2net.

Run image in the background using the following command:

docker run -d -v /home/pi/.omnik/config.yaml:/config/config.yaml -p 10004:10004 --restart unless-stopped --name omnikdataloggerproxy jbouwh/omnikdataloggerproxy:latest

Intercepting inverter logger messages

Your inverter will probably send updates to the fixed IP address '176.58.117.69'. To make your docker listen to this address, you need to reroute the traffic. See also this page at my website. If you are using a Raspberry PI with docker you need to be careful that you do not disturb the IP tables set by Docker. A way to set the NAT rerouting is using iptables-persistent.

sudo apt-get install iptables-persistent

At boot this will restore the config of your IP tables before starting Docker.

The IPv4 NAT rule will be stored in /etc/iptables/rules.ipv4 and should be something like:

# Generated by xtables-save v1.8.2 on Tue Jul 28 12:40:29 2020
*nat
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -d 176.58.117.69/32 -p tcp -m tcp --dport 10004 -j DNAT --to-destination 192.168.1.100:10004
-A OUTPUT -d 176.58.117.69/32 -p tcp -j DNAT --to-destination 192.168.1.30
COMMIT
# Completed on Tue Jul 28 12:40:29 2020

In the example 192.168.1.100 is the IP address of Raspberry PI the router will forward to.

You internet router should have a static route to this IP address for the forwading of 176.58.117.69. Your static route will be something like:

network mask forward address/next hop
176.58.117.69 255.255.255.255 or /32 192.168.1.100

This will definitely break your native omnikportal logging. But there is still a possiblity to forward your logging, but that needs to be somewhere else on the internet where you can run another instance of omnikdataloggerproxy. This last hop will send the package to 176.58.117.69 so your native logging could start working again.