With the input from the Domoticz script of Sincze I have it working now using a command_line sensor (you could also use the rest sensor).
CC @Philippe_Bouwen
Steps:
- Go to the this page (change the IP adres to the on of your Omnik webinterface) -> http://192.168.1.127/js/status.js
- Search for the text
webData
or myDeviceArray
. The page will contain one of these.
Example
var webData="NLDN**2017******,NL1-V1.0-0118-4,V2.0-0028,omnik4000tl ,4000,584,345,33734,,4,";
var myDeviceArray=new Array(); myDeviceArray[0]="AANN3020,V5.04Build230,V4.13Build253,Omnik3000tl,3000,1313,685,9429,,1,";
- Use the following code (change the IP address and change
myDeviceArray\[0]\
to Webdata
if needed according to step 2) to generate 3 sensors:
sensor:
- platform: command_line
name: Solar Power Current
scan_interval: 30
command: 'curl http://192.168.1.127/js/status.js'
value_template: >-
{{ ((value | regex_findall_index('myDeviceArray\[0\]=".*?(?=";)')).split(',')[5] | float) | int }}
unit_of_measurement: 'W'
- platform: command_line
name: Solar Power Today
scan_interval: 300
command: 'curl http://192.168.1.127/js/status.js'
value_template: >-
{{ (value | regex_findall_index('myDeviceArray\[0\]=".*?(?=";)')).split(',')[6] | float / 100 }}
unit_of_measurement: 'kWh'
- platform: command_line
name: Solar Power Total
scan_interval: 14400
command: 'curl http://192.168.1.127/js/status.js'
value_template: >-
{{ (value | regex_findall_index('myDeviceArray\[0\]=".*?(?=";)')).split(',')[7] | float / 10 }}
unit_of_measurement: 'kWh'
I use the command_line
with the current power and an update interval of 30 seconds for the current power sensor.
For the sensors power today and power total I use another update interval.
Not sure how often the webpage actually refreshes, but for now I keep the interval to 30 seconds.
Advantage of using this method is that it reads the Omnik inverter locally (I blocked the access to internet for the inverter now).
It doesn’t have all the data which the custom component has, but at least the most important power data is available.
This code can be used if you own an invertor with a 9 digit serial starting with 64, but I guess it will work for all Omnik inverters.