Omink inverter in Home assistant

Hi all,

On Github I found this post from heinoldenhuis:

I’ve been trying to get this to work in my configuration, but I’m not getting any data from my inverter, nor from the Omnik portal. When I open my portal I can see all the values that are in the pyton script, but when I add a cart to my frontend I get Unknow as value.
This is my setup in configuration.yaml:

Zonnepanelen

  • platform: omnik
    datasource: portal
    inverter_host: 0
    inverter_port: 0
    inverter_serial: 1607497364
    portal_host: !secret_webadress
    portal_port: 10000
    portal_username: !secret omnikportal_username
    portal_password: !secret omnikportal_password
    scan_interval: 60
    sensors:
    actualpower: [energytotal, energytoday]
    energytoday:
    energytotal:
    hourstotal:
    invertersn:
    temperature:
    dcinputvoltage:
    dcinputcurrent:
    acoutputvoltage:
    acoutputcurrent:
    acoutputfrequency:
    acoutputpower:
    incometoday:
    incometotal:

There are some things that are not clear to me:

  • I made source to be inverter only, because I do’nt know what the webadress for my inverter is. When setting the inverter up it displays its own network, with which you have to connect and go to a specified adress to connect the WiFi-module to my own router. When I take that adress from my router (it has no name but it’s the only adress that I cannot link to any machine in my network), I get errors in my logging saying that the adress is invalid
  • Also I don’t know which port my inverter is, or which port to use when I enter the internet portal
    As I’m just biginning to scratch the surface of Home Assistant I would like the help of anybody who can point me in the right direction to get this to work. Thanks already in advance!

Solved, for the most part. I found in a manual for the inverter that pressing Enter (in my case) on the inverter will show all sorts of information in the display of the inverter, among which the ipadress. In the configuration I added the standard port from the inverter (inverter_port: 8899) and the correct IPadress and Bingo! the values appeared in Hassio.

I would like to combine info from the portal, but somehow that still doesn’t work. If anyone could help me get things like Trees saved and CO2 saved I’d be very grateful……

Hi Ruudtb205,

Does this still work for you at this moment?
I can’t get it to work on 0.91.4…

I’m on 0.91.3, but it still works.:grinning:


This is my sensor.yaml:

  • platform: omnik
    datasource: inverter_and_portal
    inverter_host: 192.168.0.10
    inverter_port: 8899
    inverter_serial: 1607497364
    portal_host: https://www.omnikportal.com/Terminal/TerminalMain.aspx?pid=46600
    portal_port: 10000
    portal_username: !secret omnikportal_username
    portal_password: !secret omnikportal_password
    scan_interval: 60
    sensors:
    actualpower: [energytotal, energytoday]
    energytoday:
    energytotal:
    hourstotal:
    invertersn:
    temperature:
    dcinputvoltage:
    dcinputcurrent:
    acoutputvoltage:
    acoutputcurrent:
    acoutputfrequency:
    acoutputpower:
    incometoday:
    incometotal:
  • platform: template
    sensors:
    total_co2_reduction:
    icon_template: mdi:factory
    friendly_name: ‘Totaal CO2 besparing’
    unit_of_measurement: ‘T’
    value_template: “{{(states(‘sensor.omnik_energy_total’)|float * (0.46)/1000) |round(2) }}”
  • platform: template
    sensors:
    total_income:
    icon_template: mdi:euro
    friendly_name: ‘Totale inkomsten’
    unit_of_measurement: ‘€’
    value_template: “{{(states(‘sensor.omnik_energy_total’)|float * (0.19)) |round(2) }}”

Nothing special further, I made a new folder under config, in which I made a folder called Omnik, in which I placed the file sensor.py.
Do you get errors in your logging? What doesn’t work? I’m not sure I can be of much help (my coding skills are on the copy and paste level :blush:, but when it works with me you should be able to get it to work.

Thanks for your reply!

Damn, my sensor.yaml looks exactly the same, but all values are shown as ‘Unknown’.
The only error message that is shown is a timeout:

Update of sensor.omnik_ac_output_voltage is taking over 10 seconds

It seems that the only difference between our configs is the inverter serial number. Yours is 10 digits, mine 9. This is the datalogger serial shown on the Omnik Portal, right?

- platform: omnik
    datasource: inverter_and_portal
    inverter_host: !secret inverter_ip
    inverter_port: 8899
    inverter_serial: 637963166
    portal_host: https://www.omnikportal.com/Terminal/TerminalMain.aspx?come=Public&pid=96041
    portal_port: 10000
    portal_username: !secret omnikportal_username
    portal_password: !secret omnikportal_password
    scan_interval: 60
    sensors:
      actualpower: [energytotal, energytoday]
      energytoday:
      energytotal:
      hourstotal:
      invertersn:
      temperature:
      dcinputvoltage:
      dcinputcurrent:
      acoutputvoltage:
      acoutputcurrent:
      acoutputfrequency:
      acoutputpower:
      incometoday:
      incometotal:

That is a bit strange. Only thing I can think of is the ip-adress of your inverter. I had to use the menu on the inverter to find the correct ip. Meubelmaker you are using the wrong ip?

I checked the IP on the display of the inverter as well as on the router itself.
Ping replies are received on the IP and a port scan confirms port 8899 is indeed open.

Very strange…
My guess is it’s something with the newer wifi cards they use…

I wanted to look if there was a new version from heinoldenhuis on Github, where I saw your issue.
In your issue I see the error you get:
Integrations need to be in their own folder. Change sensor/omnik.py to omnik/sensor.py. This will stop working soon.

Since (I think) 0.89.1 there has been a chance in how you add custom functions to H.A. In the Github instructions it says that under the config folder you need to have a folder called custom_components. In this folder you (say the instructions) make a folder called Sensor. In this folder you place the code from Github, which as by the instructions should be called Omnik.py.
From 0.89.1 on the folder under custom_components should be named Omnik (not sensor), and the .py should get the name sensor.py (not Omnik.py)
I’m not sure if this is the problem, but if you don’t have it like this I think this will solve your problem

First of all, thanks for trying to help me out, really appreciated!!

Not long after I posted that issue, I tried switching the names and found out that that specific warning was resolved, like you suggested.
The folder under custom_components is called omnik and has the sensor.py file in it.

No errors in HA, just no data coming in…

Only thing I can think of now is that there is something wrong with the !secret inverter_ip. Did you use just the numbers, without http:// in front? That’s how i did it, and that is the only thing I see that is different from mine ('that is: I cannot see what IP you use). I suggest you check that or put the ip in yout sensor.yaml (after all it’s a local IP which I trust is not reachable from the outside :slightly_smiling_face:)
The serial of the datalogger is the serial from the portal, it is possible that there is a new version of the inverter which delivers the data in an different format - that should mean the omnik.py should be altered. That’s way beyond my skills: I program by cut and paste…
Just to be sure: the IP and credentials are in secrets.yaml? With the same names? I have spent a whole week once trying to figure out why something didn’t work, and it turnd out that in my configuration.yaml I named something !secret pw, and in secrets.yaml I wrote !secret_pw…
Mistakes happen…

Yeah, in my actual configuration IP, username and password are stored in the omnik.py, not in the secret.yaml. I only changed it to post it online :slight_smile:

I guess indeed the data format must have been changed. Also for me, that is way beyond my current skills :smile:

Thanks again for your help @Ruudtb205!

Errr…… just to be sure: the file is named sensor.py, not omnik.py, right? Because that will not work any more…
I thought you mentioned it above, and this is a typo?

Yes, that is a typo indeed :smiley:

Hi all. I created the component a while ago. Nice to see there is some use in publishing the component a while ago. During the time I have made some changes to keep it working in HA.
I have updated the code in github so the newer custom_component structure is used. Currently it works in 0.92.1.

Around the start of this year I found out that the Omnik Portal API is not operational anymore.
I therefore removed the portal functionality from the component.
Seems that the inverter is running fine for now when offline:

1 Like

Dear all, I followed the instructions but I am not able to read any value from my Omnik: sensor is always “0”.
I have to say that the configuration is very simple, standard port and fixed IP address are used. but I notice that there is also an other value of the inverter s/n starting with “FRB…” which is not accepted by the extension.
The inverter is in WiFi.
Any idea?

Are you able to login on the web interface from your inverter (http://(ip-address)/)?

I understand now that my documentation is refering to the inverter serial, but this should the Device serial number from the Wifi or LAN module (Under Device information), something like 16xxxxx603:

Ja, I have access to my inverter and I used the device serial number, but It doesn’t work (always 0).
My config:

platform: omnik
inverter_host: 192.168.0.6
inverter_port: 8899
inverter_serial: 6xxxxxxxx7
scan_interval: 60
sensors:
actualpower: [energytotal, energytoday]

Do you have identation of two spaces for each part?

In the following figure I have 2 spaces before “- platform…”?
And then 4 spaces before “inverter…” etc.
And another 2 spaces for the sensors?

image
(PS. If you use sensors: !include then remove 2 space before each line).

If this is not working then I am curious if there are any errors in you homeassistant.log related to the omnik sensor?
Offcourse you can ignore the “You are using a custom integration for omnik which has not …”.

If this is not working then it might be that;

  • Your Omnik serial start with 6xxx, maybe a newer omnik module which not supports the commands the sensor is sending? The Omnik inverter is normally connecting to the remote Omnik portal. Those packets I have captured using Wireshark and a modification on my router. The message in those packets should look simular like the packets send by the sensor.
  • Are you using the right serial? The serial is converted to a byte array by the sensor (in fact the serial is first converted to hex and then to a byte array). After this the bytes are used twice in the request message.
  • Could you determine if the Omnik inverter is responding with an answer after the request? This might be an message with values, timeout, or an error for example.

Another option is to use some tooling on your PC which sends the requests and look if an answer is send back. I have used this in the past while debugging, have to look how to do this.

Hi,
no errors in log files, indentation is correct (2 spaces), serial is correct and the port 8899 is open.

I have added a debug logger function to show if you receive any message from the omnik inverter.

You can find this file at:
-removed

If you add the following logger configuration to configuration.yaml then a debug log is added for the omnik component:

# Log only sensor omnik debug logs.
logger:
  default: warning
  logs:
    custom_components.omnik: debug

The debug logs are visible in the homeassistant.log file (not at the HA webfrontend).
It looks like:

Hopefully you will getting a response message back.
Otherwise it is very difficult for me to determine if your Omnik inverter accepts the request message.

Note: The raw message contains hex values of the message and also contains your serialnumber from your omnik wifi module. If you would please send me a log file with a personal message.

If this does not work, may I ask how you are using Home Assistant?
Is it based upon Hassio? Or do you have another installation?