Installation:
1. HACS öffnen und unter den benutzerdefinierten Repositories https://github.com/Philra94/homeassistant-energy-charts hinzufügen.
2. Typ „Integration“ auswählen und Energy-Charts installieren.
3. Home Assistant neu starten.
4. Unter Einstellungen → Geräte & Dienste Energy-Charts hinzufügen.
5. Land „Germany“, Aktualisierung 15 Minuten und historische Daten „Week“ auswählen.
Datenaggregation:
Kleine Helfer-Sensoren erstellen, um die einzelnen Kategorien zusammenzufassen
Strommix auf acht Erzeugungskategorien reduzieren.
Damit bleibt das Diagramm übersichtlich, ohne die wesentlichen Unterschiede zwischen den Energieträgern zu verlieren.
Füge folgende Definition in deine configuration.yaml ein. Falls du bereits einen template:-Abschnitt hast, ergänze nur den darunterliegenden - sensor:-Block.
# Einsparungspotential Solarstrom
template:
- sensor:
- unique_id: gesamteinsparung_strom
unit_of_measurement: "EUR"
default_entity_id: sensor.gesamteinsparung_strom
name: Gesamteinsparung_Strom
state: '{{ states("sensor.hm800_ch1_yieldtotal") | float * 0,42 }}'
# state_class: total
# Stromverbrauch in kWh
- sensor:
- unique_id: stromverbrauch_kwh
unit_of_measurement: kWh
default_entity_id: sensor.stromverbrauch_kwh
name: Stromverbrauch kWh
state: '{{ ((states("sensor.tasmota_sm_1_8_2") | float) / 1000) | round(2)}}'
# Stromeinspeisung in kWh
- sensor:
- unique_id: stromeinspeisung_kwh
default_entity_id: sensor.stromeinspeisung_kwh
name: Stromeinspeisung kWh
state: '{{ ((states("sensor.tasmota_sm_2_8_0") | float) / 1000) | round(2)}}'
# RainText
- sensor:
- default_entity_id: sensor.rrraintext
name: Regentext
state: '{{ state_attr(''sensor.regenradar'', ''raintext'') }}'
# Rain in 30 mimutes
- sensor:
- default_entity_id: sensor.rrrainin30min
name: Regenin30min
state: '{{ state_attr(''sensor.regenradar'', ''rainin30min'') }}'
# Rain in 60 minutes
- sensor:
- default_entity_id: sensor.rrrainin60min
name: Regenin60min
state: '{{ state_attr(''sensor.regenradar'', ''rainin60min'') }}'
# Rain in 120 Minutes
- sensor:
- default_entity_id: sensor.rrrainin120min
name: Regenin120min
state: '{{ state_attr(''sensor.regenradar'', ''rainin120min'') }}'
# Stromstärke MiniCar Ladeleistung
- sensor:
- unique_id: laden_minicar
unit_of_measurement: W
default_entity_id: sensor.laden_minicar
name: Laden MiniCar
state: '{{ (((states("sensor.esp13_adc_computed") | float) - 0.14) * 1024 | round(2))
}}'
# STROMMIX DEUTSCHLAND
# Unter dem vorhandenen template: einfügen
- sensor:
# MW-SENSOREN
- name: "Strommix Solar"
unique_id: strommix_solar
unit_of_measurement: "MW"
state_class: measurement
state: >
{{ states('sensor.energy_charts_germany_solar') | float(0) }}
- name: "Strommix Wind"
unique_id: strommix_wind
unit_of_measurement: "MW"
state_class: measurement
state: >
{{ states('sensor.energy_charts_germany_wind_total') | float(0) }}
- name: "Strommix Wasser"
unique_id: strommix_wasser
unit_of_measurement: "MW"
state_class: measurement
state: >
{{
(states('sensor.energy_charts_germany_hydro_run_of_river') | float(0))
+ (states('sensor.energy_charts_germany_hydro_water_reservoir') | float(0))
}}
- name: "Strommix Sonstige EE"
unique_id: strommix_sonstige_ee
unit_of_measurement: "MW"
state_class: measurement
state: >
{{
(states('sensor.energy_charts_germany_biomass') | float(0))
+ (states('sensor.energy_charts_germany_geothermal') | float(0))
}}
- name: "Strommix Kohle"
unique_id: strommix_kohle
unit_of_measurement: "MW"
state_class: measurement
state: >
{{
(states('sensor.energy_charts_germany_fossil_brown_coal_lignite') | float(0))
+ (states('sensor.energy_charts_germany_fossil_hard_coal') | float(0))
+ (states('sensor.energy_charts_germany_fossil_coal_derived_gas') | float(0))
}}
- name: "Strommix Gas und Oel"
unique_id: strommix_gas_und_oel
unit_of_measurement: "MW"
state_class: measurement
state: >
{{
(states('sensor.energy_charts_germany_fossil_gas') | float(0))
+ (states('sensor.energy_charts_germany_fossil_oil') | float(0))
}}
- name: "Strommix Atom"
unique_id: strommix_atom
unit_of_measurement: "MW"
state_class: measurement
state: >
{{ states('sensor.energy_charts_germany_nuclear_production') | float(0) }}
- name: "Strommix Sonstige"
unique_id: strommix_sonstige
unit_of_measurement: "MW"
state_class: measurement
state: >
{{
(states('sensor.energy_charts_germany_hydro_pumped_storage') | float(0))
+ (states('sensor.energy_charts_germany_waste') | float(0))
+ (states('sensor.energy_charts_germany_others') | float(0))
}}
# PROZENT-SENSOREN
# Gemeinsamer Nenner: alle acht MW-Sensoren
- name: "Strommix Anteil Solar"
unique_id: strommix_anteil_solar
unit_of_measurement: "%"
state_class: measurement
availability: &strommix_availability >
{% set ids = [
'sensor.strommix_solar',
'sensor.strommix_wind',
'sensor.strommix_wasser',
'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle',
'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom',
'sensor.strommix_sonstige'
] %}
{% set werte = ids | map('states') | list %}
{{ werte | select('is_number') | list | count == 8
and werte | map('float', 0) | sum > 0 }}
state: &strommix_anteil_solar >
{% set ids = [
'sensor.strommix_solar',
'sensor.strommix_wind',
'sensor.strommix_wasser',
'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle',
'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom',
'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_solar') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Wind"
unique_id: strommix_anteil_wind
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar', 'sensor.strommix_wind',
'sensor.strommix_wasser', 'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle', 'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom', 'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_wind') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Wasser"
unique_id: strommix_anteil_wasser
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar', 'sensor.strommix_wind',
'sensor.strommix_wasser', 'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle', 'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom', 'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_wasser') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Sonstige EE"
unique_id: strommix_anteil_sonstige_ee
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar', 'sensor.strommix_wind',
'sensor.strommix_wasser', 'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle', 'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom', 'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_sonstige_ee') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Kohle"
unique_id: strommix_anteil_kohle
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar', 'sensor.strommix_wind',
'sensor.strommix_wasser', 'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle', 'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom', 'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_kohle') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Gas und Oel"
unique_id: strommix_anteil_gas_und_oel
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar',
'sensor.strommix_wind',
'sensor.strommix_wasser',
'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle',
'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom',
'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_gas_und_oel_2') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Atom"
unique_id: strommix_anteil_atom
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar', 'sensor.strommix_wind',
'sensor.strommix_wasser', 'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle', 'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom', 'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_atom') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
- name: "Strommix Anteil Sonstige"
unique_id: strommix_anteil_sonstige
unit_of_measurement: "%"
state_class: measurement
availability: *strommix_availability
state: >
{% set ids = [
'sensor.strommix_solar', 'sensor.strommix_wind',
'sensor.strommix_wasser', 'sensor.strommix_sonstige_ee',
'sensor.strommix_kohle', 'sensor.strommix_gas_und_oel_2',
'sensor.strommix_atom', 'sensor.strommix_sonstige'
] %}
{% set gesamt = ids | map('states') | map('float', 0) | sum %}
{{ ((states('sensor.strommix_sonstige') | float(0))
/ gesamt * 100) | round(2) if gesamt > 0 else 0 }}
ApexCart-Definition:
type: custom:apexcharts-card
graph_span: 7d
span:
end: day
stacked: true
update_interval: 15min
header:
show: true
title: Strommix Deutschland – 7 Tage
apex_config:
chart:
height: 400
plotOptions:
bar:
columnWidth: 65%
borderRadius: 0
dataLabels:
enabled: false
legend:
show: true
position: bottom
tooltip:
shared: true
intersect: false
yaxis:
- min: 0
max: 100
decimals: 0
apex_config:
title:
text: Anteil (%)
all_series_config:
type: column
stack_group: strommix
group_by:
func: avg
duration: 1d
fill: zero
show:
legend_value: false
series:
- entity: sensor.strommix_anteil_solar
name: Solar
color: '#FFD54F'
- entity: sensor.strommix_anteil_wind
name: Wind
color: '#66BB6A'
- entity: sensor.strommix_anteil_wasser
name: Wasser
color: '#2196F3'
- entity: sensor.strommix_anteil_sonstige_ee
name: Sonstige EE
color: '#388E3C'
- entity: sensor.strommix_anteil_kohle
name: Kohle
color: '#795548'
- entity: sensor.strommix_anteil_gas_und_oel_2
name: Gas und Öl
color: '#FF9800'
- entity: sensor.strommix_anteil_atom
name: Atom
color: '#9C27B0'
- entity: sensor.strommix_anteil_sonstige
name: Sonstige
color: '#90A4AE'
Und mit Daten schaut die Grafik dann so aus:
Keine Kommentare:
Kommentar veröffentlichen