{"id":115,"date":"2020-06-01T15:54:54","date_gmt":"2020-06-01T13:54:54","guid":{"rendered":"https:\/\/jbsoft.nl\/site\/?page_id=115"},"modified":"2021-10-25T13:29:31","modified_gmt":"2021-10-25T11:29:31","slug":"logger-interception-using-omnik-datalogger","status":"publish","type":"page","link":"https:\/\/jbsoft.nl\/site\/omnik-datalogger\/logger-interception-using-omnik-datalogger\/","title":{"rendered":"Logger interception using Omnik datalogger"},"content":{"rendered":"\n<p><a href=\"https:\/\/github.com\/jbouwh\/omnikdataloggerproxy\/\" target=\"_blank\" rel=\"noreferrer noopener\">Here<\/a> you can find a proxy script that can help you to intercept your inverters logging.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Be aware that with interception the logging is no longer delivered to the logging servers in the cloud unless you redirect it again to the Solarman logging servers.<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">How interception works<\/h4>\n\n\n\n<p>By rerouting trafic for &#8216;176.58.117.69&#8217; to the host running omnikloggerproxy.py and using Network Address Translation, you can simulate the logger server and process to logger data.<\/p>\n\n\n\n<p>The rerouting can to be done at the routing device that is the default gateway for the inverter. I am using a Fritz!Box .<\/p>\n\n\n\n<p>Rerouting can be configured by adding a static routing rule for  176.58.117.69 to the internal ip adress of the host running the NAT rules and the omnikloggerproxy.py script.<\/p>\n\n\n\n<p>Example adding static route on Fritz!Box:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-6.png\" alt=\"\" class=\"wp-image-148\" width=\"139\" height=\"405\" srcset=\"https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-6.png 243w, https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-6-103x300.png 103w\" sizes=\"auto, (max-width: 139px) 85vw, 139px\" \/><figcaption>Login on your router en open the Network settings page.<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-11.png\" alt=\"\" class=\"wp-image-153\" width=\"367\" height=\"83\" srcset=\"https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-11.png 530w, https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-11-300x68.png 300w\" sizes=\"auto, (max-width: 367px) 85vw, 367px\" \/><figcaption>Select IPv4 Routes under Static Routing Table<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-12.png\" alt=\"\" class=\"wp-image-154\" width=\"347\" height=\"280\" srcset=\"https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-12.png 480w, https:\/\/jbsoft.nl\/site\/wp-content\/uploads\/2020\/06\/image-12-300x242.png 300w\" sizes=\"auto, (max-width: 347px) 85vw, 347px\" \/><figcaption>Add a static route with subnet mask 255.255.255.255 (\/32).<\/figcaption><\/figure>\n\n\n\n<p>See the <a href=\"https:\/\/github.com\/jbouwh\/omnikdataloggerproxy\/blob\/main\/omnikproxy_example_startup.sh\" target=\"_blank\" rel=\"noreferrer noopener\">comments in the example script<\/a> for more details. Note: Using <strong>iptables<\/strong> on a Synology NAS if not officially supported. The nas might reload the iptables during updates or security checks. An option is to make a second script that runs daily before sunrise that reloads the iptables to ensure the Network Address Translation is performed.<\/p>\n\n\n\n<p>An example (bash) for the iptables rules to configure:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">#! \/bin\/bash\nLOCAL_IP=\"192.168.1.x\"\nDEST_PORT=\"10004\"\nOMNIK_LOGGER_ADDRESS=\"176.58.117.69\"\n# Flush existing NAT rules\niptables -t nat -F OUTPUT\niptables -t nat -F PREROUTING\n# Set NAT RULES correctly\niptables -t nat -A PREROUTING -p tcp -d $OMNIK_LOGGER_ADDRESS --dport $DEST_PORT -j DNAT --to-destination $LOCAL_IP:$DEST_PORT\niptables -t nat -A OUTPUT -p tcp -d $OMNIK_LOGGER_ADDRESS -j DNAT --to-destination $LOCAL_IP<\/pre>\n\n\n\n<p>Adjust LOCAL_IP to the IP address of the host in your internal network that is used for the rerouting.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>If you have an unused Raspberry PI or some othe devive that can run Linux, my advise would be to use that device for interception the logger traffic, to avoid conflicts on your Synology. <\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">Still forward the logging to Omnik portal<\/h4>\n\n\n\n<p>The omnikloggerproxy.py script enables you to intercept the logger data, send it to MQTT and still forward your data to the logging servers in the cloud. There only problem is that by rerouting  trafic to &#8216;176.58.117.69&#8217; will also prevent forwarding. This way you will not get any updates forwarded to the SolarMan services. If you have the possibility to run omnikloggerproxy.py on a host elsewhere on the Internet, you could still forward your inverters logging to that host and finally proxy the logging to the SolarMAN portals. This scenario is supported. The second instance of omnikloggerproxy.py will then forward to 176.58.117.69:10004 over TCP so it will be delivered to the Solarman infrastructure and will become available in <a rel=\"noreferrer noopener\" href=\"https:\/\/www.solarmanpv.com\/portal\" target=\"_blank\">https:\/\/www.solarmanpv.com\/portal<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here you can find a proxy script that can help you to intercept your inverters logging. Be aware that with interception the logging is no longer delivered to the logging servers in the cloud unless you redirect it again to the Solarman logging servers. How interception works By rerouting trafic for &#8216;176.58.117.69&#8217; to the host &hellip; <a href=\"https:\/\/jbsoft.nl\/site\/omnik-datalogger\/logger-interception-using-omnik-datalogger\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Logger interception using Omnik datalogger&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":39,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-115","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/pages\/115","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/comments?post=115"}],"version-history":[{"count":15,"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/pages\/115\/revisions"}],"predecessor-version":[{"id":423,"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/pages\/115\/revisions\/423"}],"up":[{"embeddable":true,"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/pages\/39"}],"wp:attachment":[{"href":"https:\/\/jbsoft.nl\/site\/wp-json\/wp\/v2\/media?parent=115"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}