Omink inverter in Home assistant

Hey Hein,

Small question. I’m a bit unclear as to how one gets to the inverter configuration page in your post. Mine only has a simple 1 page menu where i can set the wireless network to connect to. Is the menu you have added in a later firmware update or something?

Hey Shamalamadindong,

Maybe there is a difference between the inverter (other firmware etc.).
In my screenshot I am connected to a Wifi accesspoint.
Are you in your case also already connected to a Wifi accesspoint?

Kind regards,
Hein

I have a new Omnik inverter as well, the serial also starts with 64 and has 9 digits and unfortunately it is not working with this component, all sensors show Unknown.

I found this script made for Domoticz which reads data from the local webinterface of the inverter → GitHub - sincze/Domoticz-Omnik-Local-Web-Plugin: Domoticz Python Plugin that can read data from the local inverter webinterface.

That should work with either serial number as it just reads data from the webinterface. I will see if I can adapt the script to make it working with HA. If I have any good progress I will give an update here, but it could take some time as I have little spare time :wink:

If anyone wants to change that script in the meanwhile to use it with HA and share it here, that would be great as well :+1:

This would be great! I don’t think I can support you with this, but would really like to see this working

I had a quick look and the scrape sensor or rest sensor should work for this.
All relevant information is in http://ip-of-your-inverter/js/status.js. For my invertor the relevant values are stored in myDeviceArray[0].
Will try to have a look at this in the coming days.

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:

  1. Go to the this page (change the IP adres to the on of your Omnik webinterface) -> http://192.168.1.127/js/status.js
  2. 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,";
  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.

1 Like

Wow thanks Gerard, gonna give it a try!

I do think the scrape sensor is being discontinued, but hopefully it keeps working :crossed_fingers:

Let me know if it works for you :+1:

BTW this is not using the scrape sensor, but the command_line and/or rest sensor. I have changed the scripts a little bit for the update interval of the daily and total power. No need to update that every minute. Will update the script in my post above later. Edit: script in post above is updated.

P.S. The scrape sensor will remain, only integrations using scrape have been disabled as that is difficult to maintain as websites can often change, but you can still use the scrape sensor yourself.

Hi Gerard, your solution worked for me. Thanks a lot.

Good to hear, thanks for your confirmation.

@pgdg71 @gerard33 @Philippe_Bouwen

I’ve been inspired by the custom sensor of @gerard33 and created a custom component that provides a sensor.solar_power_current, sensor.solar_power_today, sensor.solar_power_total.

Check it out: https://github.com/robbinjanssen/home-assistant-omnik-inverter

You can also add it as custom repository in HACS :slight_smile:

2 Likes

Great stuff, guys!
The configuration from @gerard33 works like a charm. I also tried @robbinjanssen 's integration, nice too! I have both now running in parallel (to compare).

So far I see @robbinjanssen 's integration/HACS component doesn’t reset the solar_power_today value. I do see it updates the .powertoday.pickle (every 30s or minute or so) - but it keeps the highest value recorded so far. So if I had yesterday a total of 10kWh, it will only start showing data after I pass the 10kWh…

And then stay at the new high. @robbinjanssen, I do not see the reset behavior from the inverter you described. At 22:00 hours my inverter still reports the day total correctly (using Gerard’s configuration example), so maybe this has something to do with it?

Thanks for trying the component!

Seems like the cache doesn’t reset at 00:00 in your case, strange. Did some thinking and I think it would be best if I made the caching optional in the config! I’ll see if I can find some time this week to update the component!

Hi @Flaker the caching should be fixed now, please try upgrading to v1.2.0.

For some reason after your post my inverter started acting up weird as well and didn’t “reset” the power today before or after 00:00, but somewhere around 04:00. Anyway, the current caching mechanism makes sure it resets at 00:00 and will only register the new value if it differs from the cache value.

Let me know it this works for your :slight_smile:

Note: Shout out to @gerard33 as he has been contributing to the component as well :slight_smile:

Thank you @robbinjanssen ! Installed it as soon as it became available and it has been running fine for the past days. I did notice the Omnik does reset the day counter exactly at sunrise. Nice, as also after midnight you can see what the was delivered the previous day. Maybe an idea for a future upgrade as Home Assistant does have a trigger for sunrise?
P.S. I had one freeze but that was the Omnik that became unresponsive. A power off/on did the trick. Thanks again for a great component!

If you don’t want to reset the power at midnight, then you can disable the cache and the output will be whatever the omnik tells home assistant it is :slight_smile: So in your you can see after midnight what your power delivery was. The reason I want the power to be reset at 00:00 is for graph/stats purposes :slight_smile:

This way you can create a fancy graph:

@robbinjanssen, thank you, I will give it a try. I do notice however that your component ‘freezes’ after a few days to a week (meaning the graphs just show 0 and the total counter stays stuck at the value at the moment of ‘freezing’). The individual calls from @gerard33 keep functioning however. I did an analysis in the log files (as it is apparent from the graph at what time no more updates are processed) and found the following:

  • In the moments leading up to the freeze, I see the Data DEBUG messages every 30 seconds in the log.
  • On the moment of the ‘freeze’, there is an error: “Update for sensor.solar_paneles_current fails” (this is the individual call from @gerard33.
  • The debug messages from thje omnik_inverter.sensor keep coming every 30 seconds. But from this time, data is no longer shown in the graph.
  • About 7 hours later, the omnik_inverter.sensor does not get any data anymore (and it stays that way in the update every 30 seconds): WARNING (MainThread) [homeassistant.components.sensor] Updating omnik_inverter sensor took longer than the scheduled update interval 0:00:30

The culprit may be that we’re both using the same call, but I did start using the separate @gerard33 queries as I had the omnik_inverter.sensor do the same freezes before. Hmm, I’ll give it another try with the caching turned off and also with the individual calls turned off (no conflicts).

I would love to have such a bar graph for my omnik. Could you maybe explain how you achieved this? Thanks!

I think he used the custom:mini-graph-card component for it, or at least I did. Here is my configuration:

  - entity: sensor.solar_power_today
    name: 1
group_by: date
hours_to_show: 168
icon: 'mdi:weather-sunny'
name: Per dag 1
points_per_hour: 1
show:
  graph: bar
type: 'custom:mini-graph-card'

Like @Sjorsa said, you can do it by using the mini-graph-card. You can install it through HACS.

This is my current view:

Code:

color_thresholds:
  - color: '#3498db'
    value: 0
  - color: '#f39c12'
    value: 1000
  - color: '#c0392b'
    value: 1800
entities:
  - entity: sensor.solar_power_current
    index: 0
    show_points: true
    state_adaptive_color: true
hour24: true
hours_to_show: 24
icon: 'mdi:weather-sunny'
line_width: 2
lower_bound_secondary: 0
name: Zonnepanelen actueel
points_per_hour: 20
show:
  extrema: true
  points: false
type: 'custom:mini-graph-card'

And:

aggregate_func: max
cache: false
entities:
  - color: '#e74c3c'
    entity: sensor.solar_power_today
    index: 0
    show_points: true
group_by: date
hours_to_show: 168
name: Zonnepanelen vandaag
show:
  graph: bar
type: 'custom:mini-graph-card'