EDIT: this thread is obsolete. Three new configuration can be found here:
I have been working on setting up the SolarEdge Modbus integration and creating the right sensors etc for this platform to be able to get almost live updates in my Lovelace Dashboard and also use this data to feed the new Energy Page in the latest Homeassistant updates. I took me a while to get everything working properly, so I thought I could share my setup here. I am really happy with this integration since now I have one less dependency on cloud data. All the required information gets read directly inside my own home network and on top of that the information is almost live.
Hopefully someone else can use this information tooâŚ
This is what I wanted to have live updates on:
So in the confguration.yaml I defined the modbus integration and create utility meters for my different sensors.
In the sensors.yaml I used the integration platform to calculate Wh based on the live updates from the modbus sensors in W. Also here are the seperate modbus integration sensors. Still working on the âBattery Stateâ sensor to figure out what the numbers mean (I know that battery_state 3 is charging)
And then in the template.yaml I did some if then else statements to create a sensor for imported energy and exported energy. The modbus gives me only one sensor for the power grid which has values which are positive or negative. I wanted to seperate these in a dedicated import and export sensor.
So all that led to the following configs:
configuration.yaml
solaredge_modbus:
name: 'SolarEdge Modbus'
host: ip adress of inverter
port: 1502
scan_interval: 3
read_meter1: true
read_meter2: false
read_battery: true
utility_meter:
solar_imported_power_daily:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Daily
cycle: daily
solar_imported_power_weekly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Weekly
cycle: weekly
solar_imported_power_monthly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Monthly
cycle: monthly
solar_imported_power_yearly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Yearly
cycle: yearly
solar_exported_power_daily:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Daily
cycle: daily
solar_exported_power_weekly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Weekly
cycle: weekly
solar_exported_power_monthly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Monthly
cycle: monthly
solar_exported_power_yearly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Yearly
cycle: yearly
solar_production_daily:
source: sensor.solar_production_kwh
name: Solar Production Daily
cycle: daily
solar_production_weekly:
source: sensor.solar_production_kwh
name: Solar Production Weekly
cycle: weekly
solar_production_monthly:
source: sensor.solar_production_kwh
name: Solar Production Monthly
cycle: monthly
solar_production_yearly:
source: sensor.solar_production_kwh
name: Solar Production Yearly
cycle: yearly
solar_house_consumption_daily:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Daily
cycle: daily
solar_house_consumption_weekly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Weekly
cycle: weekly
solar_house_consumption_monthly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Monthly
cycle: monthly
solar_house_consumption_yearly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Yearly
cycle: yearly
sensors.yaml
- platform: integration
source: sensor.solar_imported_power_w
method: left
unit_prefix: k
name: solar_imported_power_kwh
- platform: integration
source: sensor.solar_exported_power_w
method: left
unit_prefix: k
name: solar_exported_power_kwh
- platform: integration
source: sensor.solar_production
method: left
unit_prefix: k
name: solar_production_kwh
- platform: integration
source: sensor.solar_house_consumption
method: left
unit_prefix: k
name: solar_house_consumption_kwh
- platform: template
sensors:
solaredgemodbus_ac_total_current:
friendly_name: "AC Total Current"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_total_current') }}"
unit_of_measurement: 'A'
solaredgemodbus_ac_current_phase_a:
friendly_name: "AC Current Phase A"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_current_phase_a') }}"
unit_of_measurement: 'A'
solaredgemodbus_ac_current_phase_b:
friendly_name: "AC Current Phase B"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_current_phase_b') }}"
unit_of_measurement: 'A'
solaredgemodbus_ac_current_phase_c:
friendly_name: "AC Current Phase C"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_current_phase_c') }}"
unit_of_measurement: 'A'
solaredgemodbus_ac_voltage_phase_ab:
friendly_name: "SolarEdge AC Output Voltage (A-B)"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_voltage_phase_ab') }}"
unit_of_measurement: 'V'
solaredgemodbus_ac_current_voltage_a:
friendly_name: "AC Voltage Phase A"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_voltage_phase_a') }}"
unit_of_measurement: 'V'
solaredgemodbus_ac_current_voltage_b:
friendly_name: "AC Voltage Phase B"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_voltage_phase_b') }}"
unit_of_measurement: 'V'
solaredgemodbus_ac_current_voltage_c:
friendly_name: "AC Voltage Phase C"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_voltage_phase_c') }}"
unit_of_measurement: 'V'
solaredgemodbus_ac_power_output:
friendly_name: "AC Power Output"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_power_output') }}"
unit_of_measurement: 'W'
solaredgemodbus_dc_current:
friendly_name: "DC Current"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'dc_current') }}"
unit_of_measurement: 'A'
solaredgemodbus_dc_voltage:
friendly_name: "DC Voltage"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'dc_voltage') }}"
unit_of_measurement: 'V'
solaredgemodbus_dc_power_input:
friendly_name: "DC Power Input"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'dc_power_input') }}"
unit_of_measurement: 'W'
solaredgemodbus_heatsink_temp:
friendly_name: "Inverter Heat sink Temperature"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'heat_sink_temperature') }}"
unit_of_measurement: '°C'
solaredgemodbus_inverter_efficiency:
friendly_name: "Inverter efficiency"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'computed_inverter_efficiency') }}"
unit_of_measurement: '%'
solaredgemodbus_ac_frequency:
friendly_name: "AC Frequency"
value_template: "{{ state_attr('sensor.solaredge_modbus', 'ac_frequency') }}"
unit_of_measurement: 'Hz'
solaredgemodbus_lifetime_production:
friendly_name: "Lifetime production"
value_template: "{{ (state_attr('sensor.solaredge_modbus', 'ac_lifetimeproduction') / 1000000) | round(2) }}"
unit_of_measurement: 'kWh'
solaredgemodbus_battery_power:
friendly_name: "Battery Energy Flow"
value_template: "{{ state_attr('sensor.solaredge_modbus_battery', 'battery_power') }}"
unit_of_measurement: 'W'
solaredgemodbus_battery_percentage:
friendly_name: "Battery Percentage"
value_template: "{{ state_attr('sensor.solaredge_modbus_battery', 'battery_state_of_charge') }}"
unit_of_measurement: '%'
solaredgemodbus_battery_status:
friendly_name: "Battery Status"
value_template: "{{ state_attr('sensor.solaredge_modbus_battery', 'battery_state') }}"
solaredgemodbus_status:
friendly_name: "SolarEdge Status"
value_template: >-
{% if state_attr('sensor.solaredge_modbus', 'status') == 1 %}
Off
{% elif state_attr('sensor.solaredge_modbus', 'status') == 2 %}
Sleep
{% elif state_attr('sensor.solaredge_modbus', 'status') == 3 %}
Wake-Up
{% elif state_attr('sensor.solaredge_modbus', 'status') == 4 %}
Working
{% elif state_attr('sensor.solaredge_modbus', 'status') == 5 %}
Throttled
{% elif state_attr('sensor.solaredge_modbus', 'status') == 6 %}
Shut-Down
{% elif state_attr('sensor.solaredge_modbus', 'status') == 7 %}
Fault
{% elif state_attr('sensor.solaredge_modbus', 'status') == 8 %}
Maintenance
{% else %}
Unknown
{% endif %}
template.yaml
- sensor:
#==============================
#=== Solar Custom Card
#==============================
- name: "Solar Selfconsumption Ratio"
unique_id: solar_selfconsumption_ratio
state: "{{((states('sensor.solar_house_consumption_daily') | float / states('sensor.solar_production_daily') | float) * 100 ) | round (0)}}"
- name: "Solar Autarkie Ratio"
unique_id: solar_autarkie_ratio
state: "{{((1 - (states('sensor.solar_imported_power_daily') | float / states('sensor.solar_house_consumption_daily') | float)) * 100 ) | round (0)}}"
- name: "Solar Lifetime Energy kW"
unique_id: solar_lifetime_energy_kw
unit_of_measurement: 'MWh'
icon: >-
mdi:solar-power
state_class: measurement
device_class: energy
state: "{{ ((states('sensor.solaredge_lifetime_energy') | float) / 1000000) | round (2) }}"
- name: "Solar Production"
unique_id: solar_production
state_class: measurement
device_class: energy
unit_of_measurement: 'W'
state: >
{% if ((states('sensor.solaredgemodbus_ac_power_output') | float) + (states('sensor.solaredge_modbus_battery') | float) <= 0) %}
0
{% else %}
{{((states('sensor.solaredgemodbus_ac_power_output') | float + states('sensor.solaredge_modbus_battery') | float) )}}
{% endif %}
- name: "Solar House Consumption"
unique_id: solar_house_consumption
state_class: measurement
device_class: energy
unit_of_measurement: 'W'
state: "{{((states('sensor.solaredgemodbus_ac_power_output') | float) - (states('sensor.solaredge_modbus_meter_1') | float))}}"
- name: "Solar Imported Power W"
unique_id: solar_imported_power_w
state_class: measurement
device_class: energy
unit_of_measurement: 'W'
state: >
{% if ((states('sensor.solaredge_modbus_meter_1') | float) <= 0) %}
{{(-(states('sensor.solaredge_modbus_meter_1') | float))}}
{% else %}
0
{% endif %}
- name: "Solar Exported Power W"
unique_id: solar_exported_power_w
state_class: measurement
device_class: energy
unit_of_measurement: 'W'
state: >
{% if ((states('sensor.solaredge_modbus_meter_1') | float) > 0) %}
{{(states('sensor.solaredge_modbus_meter_1') | float)}}
{% else %}
0
{% endif %}
When that all worked, I was now able to use the import and export sensors in my Energy Dashboard configuration:
The only value I still need the SolarEdge Cloud integration for is the lifetime energy. Somehow the value coming from the Modbus integration is weird and not correct. Still need to dig in to this.
Next up is making some sensors which calculate my power usage from my battery on a daily basis and some more statistics which I just like to see.