UPDATE: @ryanm101 did some great cleanup work on my original package and has added a lot of nice automations to control battery charging. He has uploaded it to github for better management of the code. The repository can be found here: GitHub - ryanm101/hasolarcfg: Solar Package for Home assistant using Solaredge Modbus multi integration
I will fork his work to match my current configuration as well and will maintain future updates there.
UPDATE 2: I have created a fork here: GitHub - Remko76/hasolarcfg: Solar Package for Home assistant using Solaredge Modbus multi integration without battery automations
In this I have now my latest code, based on @ryanm101 organisation. I will delete the code from the second post, any further changes will be on Github.
I have posted my previous configuration for the SolarEdge Modbus in the past here:
I got a lot of positive feedback and a lot of nice responses so I decided to post my updated configuration here. Why did I change? Wellā¦the Modbus Integration was not being maintained (it is now) and I got a warning that it might not work in the future, so I started looking for alternatives and with the tip from @s_ash found the ModbusMultiInverter integration from here:
This is a fork from the original integration but better maintained and also works for Multi inverter setups. So I modified my configuration to be based on this integration and cleaned up formulas using tips from @b80k and @Ashpork ā¦Thanks for your inputs!!
NOTE: my configuration uses one inveter and one battery. With some small modficiations, this is simply adjustable to a multi inverter setup or a setup without battery. Some in the other thread already did this, so I suggest to look at that for information.
Soā¦how does it look now? Well this is my Energy Dashboard:
with this configuration:
- title: Solar
path: solar
icon: mdi:lightning-bolt-circle
visible:
badges: []
cards:
- type: energy-date-selection
- type: energy-usage-graph
title: Energy Usage
- type: energy-solar-graph
title: Solar Production
- type: custom:tesla-style-solar-power-card
name: Home Energy Flow
change_house_bubble_color_with_flow: 1
threshold_in_k: 1
show_gap: true
grid_to_house_entity: sensor.solar_grid_to_house_w
grid_to_battery_entity: sensor.solar_grid_to_battery_w
generation_to_grid_entity: sensor.solar_panel_to_grid_w
generation_to_battery_entity: sensor.solar_panel_to_battery_w
generation_to_house_entity: sensor.solar_panel_to_house_w
battery_to_house_entity: sensor.solar_battery_to_house_w
battery_to_grid_entity: sensor.solar_battery_to_grid_w
battery_extra_entity: sensor.solaredge_b1_state_of_energy
- type: custom:power-distribution-card
title: ''
entities:
- name: Grid
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: Home
preset: home
icon: mdi:home
entity: sensor.solar_house_consumption_w
unit_of_display: W
decimals: 0
invert_value: true
- name: Battery
preset: battery
icon: mdi:battery-high
entity: sensor.solaredge_b1_dc_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: energy-distribution
title: Energy Distribution
- type: entities
entities:
- entity: sensor.solar_panel_production_daily
name: Produced
icon: mdi:solar-power
- entity: sensor.solar_house_consumption_daily
name: Consumed
icon: mdi:home-lightning-bolt-outline
- entity: sensor.solar_imported_power_daily
name: Imported
icon: mdi:transmission-tower-export
- entity: sensor.solar_exported_power_daily
name: Exported
icon: mdi:transmission-tower-import
- entity: sensor.solar_battery_in_daily
name: Charged
icon: mdi:battery-positive
- entity: sensor.solar_battery_out_daily
name: Discharged
icon: mdi:battery-negative
- entity: sensor.solar_lifetime_production
show_header_toggle: false
- type: entities
entities:
- entity: sensor.solar_accounting_cost_rate
name: Importrate
- entity: sensor.solar_accounting_compensation_rate
name: Exportrate
- type: custom:template-entity-row
icon: mdi:plus
name: Import Costs
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: Export Compensation
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: Electricity Bill
- type: custom:template-entity-row
icon: mdi:piggy-bank
name: Cost Saving
state: >-
{{ -(((states('sensor.solar_panel_to_house_daily') | float(0)) +
(states('sensor.solar_battery_out_daily') | float(0))) *
(states('sensor.solar_accounting_cost_rate') | float(0))) |
round(2) | replace('.', ',') }} ā¬
- entity: sensor.solar_accounting_total_weekly
icon: mdi:equal
name: Electricity Bill Weekly
- entity: sensor.solar_accounting_total_monthly
icon: mdi:equal
name: Electricity Bill Monthly
- entity: sensor.solar_accounting_total_yearly
icon: mdi:equal
name: Electricity Bill Yearly
show_header_toggle: false
- type: custom:apexcharts-card
series:
- entity: sensor.solar_panel_to_house_daily
name: Direct Consumption
color: var(--energy-solar-color)
- entity: sensor.solar_battery_out_daily
name: Battery Usage
color: var(--energy-battery-out-color)
- entity: sensor.solar_imported_power_daily
name: Imported Power
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: Autarkierate
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: Direct Usage
color: var(--energy-solar-color)
- entity: sensor.solar_battery_in_daily
name: Battery Charging
color: var(--energy-battery-in-color)
- entity: sensor.solar_exported_power_daily
name: Exported Power
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: Self Consumption
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: horizontal-stack
cards:
- type: custom:card-templater
card:
type: gauge
entity: sensor.solaredge_b1_state_of_energy
name: Batterieladung
min: 0
max: 100
needle: true
severity:
red: 0
yellow: 15
green: 50
entities:
- entity: sensor.sensor.solaredge_b1_state_of_energy
state_template: '{{ states(''sensor.solaredge_b1_state_of_energy'') | 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)
}}
Using a few custom elements:
- GitHub - RomRider/apexcharts-card: š A Lovelace card to display advanced graphs and charts based on ApexChartsJS for Home Assistant
- GitHub - reptilex/tesla-style-solar-power-card: Home assistant power card mimicking the one tesla provides for the powerwall app.
- GitHub - JonahKr/power-distribution-card: A Lovelace Card for visualizing power distributions.
- GitHub - gadgetchnnel/lovelace-card-templater: Custom Lovelace card which allows Jinja2 templates to be applied to other cards
- GitHub - thomasloven/lovelace-template-entity-row: š¹ Display whatever you want in an entities card row.
Continued in next post