Thanks for the reference.
My Leader inverter is setup with wifi and I want it to talk over the MODBUS TCP interface and not the RS485 interface, I’m hoping there is a difference.
Thanks for the reference.
My Leader inverter is setup with wifi and I want it to talk over the MODBUS TCP interface and not the RS485 interface, I’m hoping there is a difference.
UPDATE!
I tried to change the port to 1502 but this still gave me the same result all sensors unknown
I then went into a little more depth on the inverter and found the RS482 setting first tried to change this to multi meter but this gave me lots of errors on my system.
I then changed this back to solaredge and set the system to master appears it was slave before (stupid setup by the installer I guess)
I also changed the device id from 16 to 1 now I am getting updates in the sensors so thank you all for the help.
I still do not think this will work on the WIFI so I will have to try and run a cable from the inverter to a network port.
now also to setup the energy dashboard and see what the results are.
Hi, thanks for the tip with the Modbus. The connection works. However, your instructions do not work. (A spelling mistake when creating the Energy.yaml because the g is missing).
When I create the Energy.yaml, it does not find the new sensors. Not even after a restart. When I copy the Energy.yaml code into my configuration.yaml, it finds all the sensors except for the battery. Can you help me with this? I have a SE5000H inverter and the following parameters are displayed.
Aah…I may see my mistake, corrected it in the first post too:
Following configuration, sensors and templates:
configuration.yaml:
homeassistant:
packages:
energy: !include energy.yaml
create a new file called “energy.yaml” in A SUBFOLDER CALLED “packages” of your config directory with following contents:…
Hope that solves it…
EDIT: Do you have a battery connected to your inverter? If so, you need to activate that during the setup of the modbus integration. If not, my configuration will probably not work properly for you.
Another thing I noticed when looking at your sensors…some seem to have a different name as mine. For example I see “I1 AC Power” where this one is called “AC Power” for me. Now this is only the friendly name displayed in the UI, I fear that the entity ID would also be different.
If that is the case, you would need to do a “search and replace” in my energy.yaml file to modify that to your entity ID’s.
I expect you would need to replace 2 names:
search: “solaredge_ac_power” and replace with “solaredge_i1_ac_power”
search: “solaredge_dc_power” and replace with “solaredge_i1_dc_power”
BUT: first verify what the exact entity ID’s of the AC and DC power sensors are in your case and make sure you select the battery option when setting up the modbus integration (maybe delete and reinstall it). Of course, as said before, a battery needs to be connected.
I have the same issue, My install was yesterday and so far i’ve not managed to hook things up because they installed the wifi bridge/gateway not a LAN cable.
I was able to access the web interface of the inverter when connected to it’s local network (toggling P on inverter) but it seems with the wifi bridge I can’t access the inverters IP as it is on a different subnet. My wifi bridge shows up on my router as 192.168.1.95 (I made this static) and it has it’s own web interface at that IP. but the inverter is listed on that interface as being on 192.168.5.16 which I don’t think i can access.
I will likely arrange for a network cable to be installed to make this simple.
Hi mark,
Just reading this thread from the top again and saw your post about using TCP modbus over wifi.
I’m curious if you can provide any guidance.
I connected to my inverters direct wifi and enabled TCP modbus, I also connected it to my home network wi-fi.
I can see my inverter is now at my assigned LAN IP 192.168.1.96 but I cannot open the web interface at this address. I can ping it though.
Can you telnet into port 1502 on your inverter?
Checks MODBUS interface is setup.
I think those 2 things need to be checked. Well…the second point is enabled according to your post.
I also cannot open a Webinterface to my inverter, but it is in my local network as you have it as well (I use LAN, but that should not make a difference as long as it is in the same network as your Homeassistant instance).
Stupid question maybe, but have you tried uninstalling the Modbus integration in Homeassistant and reinstall it with that ip adress and port 1502?
I am not able to telnet to it on 1502 (this is the port showing as the Modbus port)
I have been reading last night about a firmware from february which apparently restricts TCP modbus to hardwired connections only. This may well be the issue as my CPU Version is 4.14.230 and the thread was talking about earlier numbers.
I’ll plan on hardwiring.
Thanks,
That is starting to make sense, my install last year worked over wifi no problem, but my new system installed two weeks ago doesn’t want to play over wifi. Switching to cable will be a pain, but I suppose I will have to do that.
The Feb firmware changelog (4.14.228) doesn’t mention MODBUS over TCP:
On my new inverters I have one running firmware 4.15.110 (beta?) and the other running 4.14.228.
My old inverters are both running firmware 4.12.35 which allows MODBUS over Wifi
Found the link discussing wifi modbus:
Yep that’s the issue I saw.
Honestly the solar edge document about TCP morbus makes no mention of wifi so the reports about staff suggesting it was never intended to work makes sense. It’s just a shame they have made an effort to stop it now.
I’m gonna buy a spool of Cat6 for wiring my house up properly so I’ll get the inverter done too, unfortunately I don’t have a long enough patch lead to hook it up through a window right now.
@Remko: Sorry for the late reply. I did not find the time earlier.
Just wanted to thank you again for all the amazing work you did. Especially for the autarky and “Eigenverbrauch” charts I shamelessly requested. I customized them a bit so they fit more nicely with the colors of the official energy dashboard. Also I now use your effectiveness sensors in the power distribution card.
Here is the result of YOUR work.
I am really happy with the current state but will tweak more over time.
Really nice configuration!!! Is that one completely custom dashboard for you, or a combination of the different dashboards.
If this is a custom one, please share the yaml config of that, looks great!
Above screenshot shows the current state of my main and custom energy dashboard.
These template sensors I added to your energy.yaml:
- name: "Solar Accounting Cost Rate"
unique_id: solar_accounting_cost_rate
icon: mdi:cash-plus
unit_of_measurement: "€/kWh"
state: >
0.3173
- name: "Solar Accounting Compensation Rate"
unique_id: solar_accounting_compensation_rate
icon: mdi:cash-minus
unit_of_measurement: "€/kWh"
state: >
0.0848
- name: "Solar Accounting Total Daily"
unique_id: solar_accounting_total_daily
icon: mdi:currency-eur
unit_of_measurement: "€"
state: >
{% set cost = (states('sensor.solar_imported_power_daily') | float(0)) * (states('sensor.solar_accounting_cost_rate') | float(0)) %}
{% set compensation = (states('sensor.solar_exported_power_daily') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
{{ (cost - compensation) | round(2) }}
- name: "Solar Accounting Total Weekly"
unique_id: solar_accounting_total_weekly
icon: mdi:currency-eur
unit_of_measurement: "€"
state: >
{% set cost = (states('sensor.solar_imported_power_weekly') | float(0)) * (states('sensor.solar_accounting_cost_rate') | float(0)) %}
{% set compensation = (states('sensor.solar_exported_power_weekly') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
{{ (cost - compensation) | round(2) }}
- name: "Solar Accounting Total Monthly"
unique_id: solar_accounting_total_monthly
icon: mdi:currency-eur
unit_of_measurement: "€"
state: >
{% set cost = (states('sensor.solar_imported_power_monthly') | float(0)) * (states('sensor.solar_accounting_cost_rate') | float(0)) %}
{% set compensation = (states('sensor.solar_exported_power_monthly') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
{{ (cost - compensation) | round(2) }}
- name: "Solar Accounting Total Yearly"
unique_id: solar_accounting_total_yearly
icon: mdi:currency-eur
unit_of_measurement: "€"
state: >
{% set cost = (states('sensor.solar_imported_power_yearly') | float(0)) * (states('sensor.solar_accounting_cost_rate') | float(0)) %}
{% set compensation = (states('sensor.solar_exported_power_yearly') | float(0)) * (states('sensor.solar_accounting_compensation_rate') | float(0)) %}
{{ (cost - compensation) | round(2) }}
- name: "Solar Inverter Effectiveness Int"
unique_id: solar_inverter_effectiveness_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_inverter_effectiveness') | float(0)) * 100) | round(2) }}
- name: "Solar Battery Effectiveness Int"
unique_id: solar_battery_effectiveness_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_battery_effectiveness')| float(0)) * 100) | round(2) }}
- name: "Solar Inverter Effectiveness Average Int"
unique_id: solar_inverter_effectiveness_average_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_inverter_effectiveness_average') | float(0)) * 100) | round(2) }}
- name: "Solar Battery Effectiveness Average Int"
unique_id: solar_battery_effectiveness_average_int
icon: mdi:percent-outline
unit_of_measurement: "%"
state: >
{{ ((states('sensor.solar_battery_effectiveness_average')| float(0)) * 100) | round(2) }}
This is the code for the dashboard which is shown in the screenshot:
- title: Solar
path: solar
icon: mdi:lightning-bolt-circle
badges: []
cards:
- type: energy-usage-graph
title: Energieverbrauch
- type: energy-solar-graph
title: Solarproduktion
- type: energy-distribution
title: Energieverteilung
- type: custom:power-distribution-card
title: ''
entities:
- name: Netz
preset: grid
icon: mdi:transmission-tower
entity: sensor.solaredge_m1_ac_power
unit_of_display: W
decimals: 0
invert_value: true
- name: Solar
preset: solar
icon: mdi:solar-power
entity: sensor.solar_panel_production_w
unit_of_display: W
decimals: 0
- name: Haus
preset: home
icon: mdi:home
entity: sensor.solar_house_consumption_w
unit_of_display: W
decimals: 0
invert_value: true
- name: Batterie
preset: battery
icon: mdi:battery-high
entity: sensor.solaredge_battery1_power
unit_of_display: W
decimals: 0
invert_value: true
center:
type: bars
content:
- preset: custom
name: INV
bar_color: var(--paper-item-icon-color)
entity: sensor.solar_inverter_effectiveness_int
- preset: custom
name: BAT
bar_color: var(--paper-item-icon-color)
entity: sensor.solar_battery_effectiveness_int
animation: flash
- type: entities
entities:
- entity: sensor.solar_accounting_cost_rate
name: Importtarif
- entity: sensor.solar_accounting_compensation_rate
name: Exporttarif
- type: custom:template-entity-row
icon: mdi:plus
name: Importkosten
state: >-
{{ ((states('sensor.solar_imported_power_daily') | float(0)) *
(states('sensor.solar_accounting_cost_rate') | float(0))) |
round(2) | replace('.', ',') }} €
- type: custom:template-entity-row
icon: mdi:minus
name: Exportvergütung
state: >-
{{ -((states('sensor.solar_exported_power_daily') | float(0)) *
(states('sensor.solar_accounting_compensation_rate') | float(0)))
| round(2) | replace('.', ',') }} €
- entity: sensor.solar_accounting_total_daily
icon: mdi:equal
name: Stromrechnung
- type: custom:template-entity-row
icon: mdi:piggy-bank
name: Kostenersparnis
state: >-
{{ -(((states('sensor.solar_panel_to_house_daily') | float(0)) +
(states('sensor.solar_battery_in_daily') | float(0))) *
(states('sensor.solar_accounting_cost_rate') | float(0))) |
round(2) | replace('.', ',') }} €
show_header_toggle: false
- type: custom:apexcharts-card
series:
- entity: sensor.solar_panel_to_house_daily
name: Direktverbrauch
color: var(--energy-solar-color)
- entity: sensor.solar_battery_out_daily
name: Batterieentnahme
color: var(--energy-battery-out-color)
- entity: sensor.solar_imported_power_daily
name: Netzbezug
color: var(--energy-grid-consumption-color)
update_interval: 1min
chart_type: donut
apex_config:
plotOptions:
pie:
expandOnClick: false
donut:
size: 50%
labels:
show: true
value:
fontSize: 32px
fontWeight: 900
total:
show: true
showAlways: true
label: Autarkiegrad
formatter: |
EVAL:function(w) {
let values = w.globals.seriesTotals;
let total = values[0] + values[1] + values[2];
let self = values[0] + values[1];
return ((self / total) * 100).toFixed(0) + "%";
}
dataLabels:
formatter: |
EVAL:function(value) {
return value.toFixed(0) + "%";
}
chart:
selection:
enabled: false
tooltip:
enabled: false
states:
normal:
filter:
type: none
value: 0
hover:
filter:
type: none
value: 0
active:
filter:
type: none
value: 0
legend:
onItemClick:
toggleDataSeries: false
onItemHover:
highlightDataSeries: false
- type: custom:apexcharts-card
series:
- entity: sensor.solar_panel_to_house_daily
name: Direktverbrauch
color: var(--energy-solar-color)
- entity: sensor.solar_battery_in_daily
name: Batterieladung
color: var(--energy-battery-in-color)
- entity: sensor.solar_exported_power_daily
name: Einspeisung
color: var(--energy-grid-return-color)
update_interval: 1min
chart_type: donut
apex_config:
plotOptions:
pie:
expandOnClick: false
donut:
size: 50%
labels:
show: true
value:
fontSize: 32px
fontWeight: 900
total:
show: true
showAlways: true
label: Eigenverbrauch
formatter: |
EVAL:function(w) {
let values = w.globals.seriesTotals;
let total = values[0] + values[1] + values[2];
let self = values[0] + values[1];
return ((self / total) * 100).toFixed(0) + "%";
}
dataLabels:
formatter: |
EVAL:function(value) {
return value.toFixed(0) + "%";
}
chart:
selection:
enabled: false
tooltip:
enabled: false
states:
normal:
filter:
type: none
value: 0
hover:
filter:
type: none
value: 0
active:
filter:
type: none
value: 0
legend:
onItemClick:
toggleDataSeries: false
onItemHover:
highlightDataSeries: false
- type: entities
entities:
- entity: sensor.solar_panel_production_daily
name: Erzeugt
icon: mdi:solar-power
- entity: sensor.solar_house_consumption_daily
name: Verbraucht
icon: mdi:home-lightning-bolt-outline
- entity: sensor.solar_imported_power_daily
name: Importiert
icon: mdi:transmission-tower-export
- entity: sensor.solar_exported_power_daily
name: Exportiert
icon: mdi:transmission-tower-import
- entity: sensor.solar_battery_in_daily
name: Gespeichert
icon: mdi:battery-positive
- entity: sensor.solar_battery_out_daily
name: Entnommen
icon: mdi:battery-negative
show_header_toggle: false
- type: horizontal-stack
cards:
- type: custom:card-templater
card:
type: gauge
entity: sensor.solaredge_battery1_state_of_charge
name: Batterieladung
min: 0
max: 100
needle: true
severity:
red: 0
yellow: 15
green: 50
entities:
- entity: sensor.solaredge_battery1_state_of_charge
state_template: >-
{{ states('sensor.solaredge_battery1_state_of_charge') |
round(0) }}
- type: custom:card-templater
card:
type: gauge
entity: sensor.solar_accounting_total_daily
name: Stromrechnung
needle: true
min: -10
max: 10
severity:
green: -10
yellow: 0
red: 3
entities:
- entity: sensor.solar_accounting_total_daily
state_template: >-
{{ '%.2f' |
format(states('sensor.solar_accounting_total_daily') | float)
}}
I use this customize.yaml for cleaner tooltips in the official energy dashboard:
sensor.solar_panel_production_daily:
friendly_name: Solarenergie
sensor.solar_battery_in_daily:
friendly_name: Aufgeladene Batterie
sensor.solar_battery_out_daily:
friendly_name: Verbrauchte Batterie
sensor.solar_house_consumption_daily:
friendly_name: Verbrauchter Strom
sensor.solar_imported_power_daily:
friendly_name: Importierter Strom
sensor.solar_exported_power_daily:
friendly_name: Exportierter Strom
sensor.solar_panel_to_house_daily:
friendly_name: Direktverbrauch
I use the following frontend repos via HACS:
This is my official energy dashboard config:
I use your “daily” sensors and my “accounting” sensors.
… and I guess that’s it.
Minor update/fix: renamed 4x “…expenses…” template sensors to “…accounting…”.
@Remko: Do you have any idea why “Verbraucht = 8,981 kWh” is a bit different from “9,2 kWh” in the “Energieverteilung” while all other values match? I would have assumed different update intervals but I looked at this several times on full hours when the values should match. It is always and only this value which is a bit off.
I ran an Ethernet cable through my window last night just to get things hooked up ASAP (permanent wiring solution to come)
I do not have a battery so I have had to alter the templates that reference batteries but I think I worked them all out.
Here is my result, thanks for @Remko for all the effort and @stephanschuster for the dashboard.
@Remko I am not able to select Solar panel production daily as the solar panel source for the energy dashboard. The entity itself exists and is increasing as expected today, but when i start to search for it on the energy dashboard configuration screen it is not listed. Is there a trick to make it appear?
I think you might be onto something. I have a Storedge inverter. It has an attached import export meter as well as an LG battery. That requires RS-485 to be configured for multi protocol. I have enabled tcp modbus but see unknown for all the states. Is it possible that home assistant is connecting to the port but the protocol is not what would be expected?
@stephanschuster Thanks for sharing your dashboard configuration. Really nice and I learnt quite a few new things from you as well. Really cool!!
To the difference between “Verbraucht” and the “House Consumption” in the “Energieverteilung”…I don’t quite know what the difference is, besides the fact that the Energy Dashboard uses it’s own algorithms to calculate that value based on the given sensors. My “Verbraucht” Sensor may use a slightly different calcuulation method (Inverter Effectiveness is included) which the Dashboard does not do. I think my calculation is more accurate and detailed and expect the difference to be based on this. It is only minor differences, so I am not worrying about it too much.
The difference to what the SolarEdge Monitoring platform shows is understood and correct. Again I use the effectiveness calculations in my outputs so that is why the actual values are a bit lower as the theoretical values SolarEdge uses.
Again, I am really thankfull for the work you guys did based on my configuration, really shows nice collaboration on these forums. Thanks again!!
@Dave2: Did you connect through cable or Wifi. It seems that Modbus does not work over Wifi.