Skip to content

Instantly share code, notes, and snippets.

@Ashpork
Last active March 19, 2025 14:22
Show Gist options
  • Select an option

  • Save Ashpork/f80fb0d3cb22356a12ed24734065061c to your computer and use it in GitHub Desktop.

Select an option

Save Ashpork/f80fb0d3cb22356a12ed24734065061c to your computer and use it in GitHub Desktop.
A snippet of the basic additional sensors configuration needed to track Panel production, on a SolarEdge single inverter, single battery system, along with the configuration used on the Power Flow Plus card.
template:
- sensor:
- name: "Solar Panel Production W"
unique_id: solar_panel_production_w
unit_of_measurement: "W"
icon: mdi:solar-power
state: >
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% set b1_dc_power = states('sensor.solaredge_b1_dc_power') | float(0) %}
{% if (i1_dc_power + b1_dc_power <= 0) %}
0
{% else %}
{{ (i1_dc_power + b1_dc_power) }}
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_dc_power') | is_number and states('sensor.solaredge_b1_dc_power') | is_number }}
- name: "Solar House Consumption W"
unique_id: solar_house_consumption_w
unit_of_measurement: "W"
icon: mdi:home
state: >
{% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
{% set m1_ac_power = states('sensor.solaredge_m1_ac_power') | float(0) %}
{% if (i1_ac_power - m1_ac_power <= 0) %}
0
{% else %}
{{ (i1_ac_power - m1_ac_power) }}
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_ac_power') | is_number and states('sensor.solaredge_m1_ac_power') | is_number }}
- name: Solar Inverter Consumption w
unique_id: solar_inverter_consumption_w
unit_of_measurement: "W"
icon: mdi:mdi:home-lightning-bolt-outline
state: >
{% set i1_ac_power = states('sensor.solaredge_i1_ac_power') | float(0) %}
{% set i1_dc_power = states('sensor.solaredge_i1_dc_power') | float(0) %}
{% if (i1_ac_power > i1_dc_power < 0) %}
{{ (i1_ac_power - i1_dc_power)| round(2) }}
{% else %}
{{ ( i1_dc_power - i1_ac_power)| round(2)}}
{% endif %}
availability: >
{{ states('sensor.solaredge_i1_ac_power') | is_number and states('sensor.solaredge_i1_dc_power') | is_number }}
- name: "Solar Imported Power W"
unique_id: solar_imported_power_w
unit_of_measurement: "W"
icon: mdi:transmission-tower-export
state: >
{% set m1_ac_power = states('sensor.solaredge_m1_ac_power') | float(0) %}
{% if (m1_ac_power < 0) %}
{{ (m1_ac_power * -1) }}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_m1_ac_power') | is_number}}
- name: "Solar Exported Power W"
unique_id: solar_exported_power_w
unit_of_measurement: "W"
icon: mdi:transmission-tower-import
state: >
{% set m1_ac_power = states('sensor.solaredge_m1_ac_power') | float(0) %}
{% if (m1_ac_power > 0) %}
{{ (m1_ac_power) }}
{% else %}
0
{% endif %}
availability: >
{{ states('sensor.solaredge_m1_ac_power') | is_number }}
sensor:
- platform: integration
source: sensor.solar_panel_production_w
method: left
unit_prefix: k
name: solar_panel_production_kwh
- platform: integration
source: sensor.solar_house_consumption_w
method: left
unit_prefix: k
name: solar_house_consumption_kwh
- 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
utility_meter:
solar_panel_production_daily:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Daily
cycle: daily
solar_house_consumption_daily:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Daily
cycle: daily
solar_imported_power_daily:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Daily
cycle: daily
solar_exported_power_daily:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Daily
cycle: daily
solar_imported_power_weekly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Weekly
cycle: weekly
solar_house_consumption_weekly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Weekly
cycle: weekly
solar_panel_production_weekly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Weekly
cycle: weekly
solar_exported_power_weekly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Weekly
cycle: weekly
solar_imported_power_monthly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Monthly
cycle: monthly
solar_house_consumption_monthly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Monthly
cycle: monthly
solar_panel_production_monthly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Monthly
cycle: monthly
solar_exported_power_monthly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Monthly
cycle: monthly
solar_imported_power_yearly:
source: sensor.solar_imported_power_kwh
name: Solar Imported Power Yearly
cycle: yearly
solar_house_consumption_yearly:
source: sensor.solar_house_consumption_kwh
name: Solar House Consumption Yearly
cycle: yearly
solar_panel_production_yearly:
source: sensor.solar_panel_production_kwh
name: Solar Panel Production Yearly
cycle: yearly
solar_exported_power_yearly:
source: sensor.solar_exported_power_kwh
name: Solar Exported Power Yearly
cycle: yearly
type: custom:power-flow-card-plus
title: Power Flow
entities:
home:
entity: sensor.solar_house_consumption_w
color_icon: solar
color_value: true
fossil_fuel_percentage:
entity: sensor.grid_fossil_fuel_percentage
icon: mdi:pine-tree
color_icon: true
display_zero: false
name: Green Import
state_type: power
color_value: true
grid:
name: Grid
entity: sensor.solaredge_m1_ac_power
display_state: one_way
color_circle: true
invert_state: true
solar:
icon: mdi:solar-panel-large
entity: sensor.solar_panel_production_w
color_value: true
color_icon: true
battery:
name: Battery
entity: sensor.solaredge_b1_dc_power
display_state: one_way
color_icon: true
color_circle: true
invert_state: true
state_of_charge: sensor.solaredge_b1_state_of_energy
color_state_of_charge_value: true
clickable_entities: true
display_zero_lines:
mode: hide
transparency: 50
grey_color:
- 189
- 189
- 189
use_new_flow_rate_model: true
w_decimals: 0
kw_decimals: 1
min_flow_rate: 0.75
max_flow_rate: 6
max_expected_power: 6000
min_expected_power: 0.01
watt_threshold: 750
dashboard_link: /energy
dashboard_link_label: Energy Summary
@nickt444
Copy link

I've settled on using the SolarEdge cloud integration for energy, as i can handle the 15 min delay (for billing and historical use) and they can do the heavy lifting of sampling and calculating energy flows.
I am using the Modbus integration for power, sampling at 5 sec, and use recorder exclusions to prevent storing these. Like you, I am using this in automations to decide when to turn things on (hot water and ventilation fans) and to increase/decrease charging rate to my EV based on current solar output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment