Skip to content

Instantly share code, notes, and snippets.

@mathieucarbou
Last active February 20, 2024 19:39
Show Gist options
  • Save mathieucarbou/290e26605437724d3b70332005e3def6 to your computer and use it in GitHub Desktop.
Save mathieucarbou/290e26605437724d3b70332005e3def6 to your computer and use it in GitHub Desktop.
Suivi EDF Tempo avec Home Assistant
template:
# https://www.home-assistant.io/integrations/sensor/
- sensor:
- name: Solar Consumed Power
unique_id: "01e37eed-3045-4eee-a786-1249567fe303"
state_class: measurement
device_class: power
unit_of_measurement: W
availability: "{{ ['sensor.solar_production_power', 'sensor.grid_returned_power']|map('states')|map('is_number')|min }}"
state: "{{ [states.sensor.solar_production_power.state|float - states.sensor.grid_returned_power.state|float, 0] | max }}"
- name: Home Consumed Power
unique_id: BE34D1AD-AB8E-4909-ACE0-BBA7D3877105
state_class: measurement
device_class: power
unit_of_measurement: W
availability: "{{ ['sensor.solar_production_power', 'sensor.grid_power']|map('states')|map('is_number')|min }}"
state: "{{ states.sensor.solar_production_power.state|float + states.sensor.grid_power.state|float }}"
- name: Solar Consumed Energy Daily
unique_id: "01e37eed-3045-4eee-a786-1249567fe305"
state_class: total_increasing
device_class: energy
unit_of_measurement: kWh
availability: "{{ ['sensor.inverters_energy_meter_daily', 'sensor.grid_energy_returned_meter_daily']|map('states')|map('is_number')|min }}"
state: >-
{% set c = states.sensor.solar_consumed_energy_daily.state|float(0) %}
{% set p = states.sensor.inverters_energy_meter_daily.state|float %}
{% set e = states.sensor.grid_energy_returned_meter_daily.state|float %}
{{ [0 if p == 0 or p < c else c, [0, p - e] | max] | max }}
- name: Solar Autoconsumption Level Daily
unique_id: "01e37eed-3045-4eee-a786-1249567fe304"
state_class: measurement
unit_of_measurement: "%"
availability: "{{ ['sensor.grid_energy_returned_meter_daily', 'sensor.inverters_energy_meter_daily']|map('states')|map('is_number')|min and states.sensor.inverters_energy_meter_daily.state|float(0) > 0 }}"
state: "{{ [100, (100 - 100 * states.sensor.grid_energy_returned_meter_daily.state|float / states.sensor.inverters_energy_meter_daily.state|float )] | min }}"
sensor:
# https://www.home-assistant.io/integrations/integration/
- platform: integration
name: Home Consumed Energy
unique_id: E2BA4424-8CA8-4D74-9A2F-F0E5EFF84622
source: sensor.home_consumed_power
unit_prefix: k
- theme: Backend-selected
title: Temp réel
path: realtime
icon: mdi:chart-line
type: sidebar
badges: []
cards:
- type: custom:apexcharts-card
graph_span: 1h
span:
end: minute
update_interval: 10s
cache: true
header:
show: true
title: Production et réseau (temps réel)
show_states: false
colorize_states: false
standard_format: true
show:
last_updated: true
apex_config:
chart:
height: 400px
all_series_config:
stroke_width: 1
type: line
curve: stepline
show:
legend_value: true
extremas: max
yaxis:
- decimals: 0
apex_config:
tickAmount: 15
forceNiceScale: true
axisTicks:
show: false
experimental:
color_threshold: true
series:
- entity: sensor.home_consumed_power
name: Consommation
color: red
- entity: sensor.openevse_power
name: OpenEVSE
color: darkgreen
- entity: sensor.grid_imported_power
name: Importation Réseau
color: blue
- entity: sensor.solar_production_power
name: Production solaire
color: yellow
stroke_width: 2
- entity: sensor.grid_returned_power
name: Exporation Réseau
color: yellow
invert: true
- type: custom:apexcharts-card
graph_span: 16h
span:
end: minute
update_interval: 5min
cache: true
header:
title: Production et réseau (moyennes 5 mins)
show: true
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
apex_config:
tickAmount: 15
forceNiceScale: true
axisTicks:
show: false
all_series_config:
type: line
curve: smooth
stroke_width: 1
unit: W
show:
legend_value: false
statistics:
type: mean
period: 5minute
align: middle
series:
- entity: sensor.solar_production_power
name: Production solaire
color: yellow
- entity: sensor.grid_imported_power
name: Importation Réseau
color: blue
- entity: sensor.home_consumed_power
name: Consommation
color: red
- entity: sensor.grid_returned_power
name: Exporation Réseau
color: yellow
invert: true
- entity: sensor.openevse_power
name: OpenEVSE
color: darkgreen
- type: custom:apexcharts-card
graph_span: 72h
span:
end: minute
update_interval: 5min
cache: true
stacked: false
header:
show: true
title: Suivi énergétique
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
apex_config:
tickAmount: 15
forceNiceScale: true
axisTicks:
show: false
all_series_config:
type: column
transform: return x * 1000;
unit: Wh
show:
legend_value: false
statistics:
type: sum
period: 5minute
align: middle
group_by:
func: diff
duration: 5mins
start_with_last: true
fill: last
series:
- entity: sensor.home_consumed_energy
name: Consommation
color: brown
- entity: sensor.solar_consumed_energy_daily
name: Production consommée
color: darkorange
- entity: sensor.openevse_energy
name: OpenEVSE
color: darkgreen
type: line
curve: smooth
stroke_width: 3
- entity: sensor.grid_energy_returned
name: Injection
color: yellow
invert: true
- type: custom:apexcharts-card
graph_span: 48h
span:
end: hour
update_interval: 15min
cache: true
stacked: true
header:
show: true
title: Suivi énergétique
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
apex_config:
tickAmount: 15
forceNiceScale: true
axisTicks:
show: false
all_series_config:
type: column
transform: return x * 1000;
unit: Wh
show:
legend_value: false
statistics:
type: sum
period: 5minute
align: middle
group_by:
func: diff
duration: 15mins
start_with_last: true
fill: last
series:
- entity: sensor.inverters_energy_meter_daily
name: Production
color: darkorange
- entity: sensor.linky_energie_soutiree_tempo_bleu_hp
name: Tempo Bleu HP
color: blue
- entity: sensor.linky_energie_soutiree_tempo_bleu_hc
name: Tempo Bleu HC
color: darkblue
- entity: sensor.linky_energie_soutiree_tempo_blanc_hp
name: Tempo Blanc HP
color: white
- entity: sensor.linky_energie_soutiree_tempo_blanc_hc
name: Tempo Blanc HC
color: lightgrey
- entity: sensor.linky_energie_soutiree_tempo_rouge_hp
name: Tempo Rouge HP
color: red
- entity: sensor.linky_energie_soutiree_tempo_rouge_hc
name: Tempo Rouge HC
color: darkred
- entity: sensor.home_consumed_energy
name: Consommation
color: brown
invert: true
- entity: sensor.grid_energy_returned
name: Injection
color: yellow
invert: true
- theme: Backend-selected
icon: mdi:chart-bar
title: Énergie
path: energy
visible:
- user: 8b29665394c74237a7759b784fc5232e
- user: 8a684135f82040e6a18959c09101ecf2
type: sidebar
badges: []
cards:
- type: custom:apexcharts-card
graph_span: 90d
span:
end: day
cache: true
update_interval: 5mins
stacked: true
header:
show: true
title: Suivi énergétique (kWh/jour)
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
max: 60
apex_config:
tickAmount: 15
forceNiceScale: true
axisTicks:
show: false
all_series_config:
type: column
unit: kWh
float_precision: 2
show:
legend_value: false
statistics:
type: sum
period: day
align: middle
group_by:
func: diff
duration: 1d
start_with_last: true
fill: last
series:
- entity: sensor.solar_consumed_energy_daily
name: Production consommée
color: darkorange
- entity: sensor.linky_energie_soutiree_tempo_bleu_hp
name: Tempo Bleu HP
color: blue
- entity: sensor.linky_energie_soutiree_tempo_bleu_hc
name: Tempo Bleu HC
color: darkblue
- entity: sensor.linky_energie_soutiree_tempo_blanc_hp
name: Tempo Blanc HP
color: white
- entity: sensor.linky_energie_soutiree_tempo_blanc_hc
name: Tempo Blanc HC
color: lightgrey
- entity: sensor.linky_energie_soutiree_tempo_rouge_hp
name: Tempo Rouge HP
color: red
- entity: sensor.linky_energie_soutiree_tempo_rouge_hc
name: Tempo Rouge HC
color: darkred
- entity: sensor.grid_energy_returned
name: Production injectée
color: yellow
invert: true
- type: custom:apexcharts-card
graph_span: 90d
span:
end: day
cache: true
update_interval: 5mins
stacked: true
header:
show: true
title: Suivi énergétique (€/jour)
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
min: -6
max: 6
apex_config:
tickAmount: 12
axisTicks:
show: false
all_series_config:
type: column
unit: €
float_precision: 2
show:
legend_value: false
statistics:
type: sum
period: day
align: middle
group_by:
duration: 1d
func: diff
start_with_last: true
fill: last
series:
- entity: sensor.linky_energie_soutiree_tempo_bleu_hp_cost
name: Tempo Bleu HP
color: blue
- entity: sensor.linky_energie_soutiree_tempo_bleu_hc_cost
name: Tempo Bleu HC
color: darkblue
- entity: sensor.linky_energie_soutiree_tempo_blanc_hp_cost
name: Tempo Blanc HP
color: white
- entity: sensor.linky_energie_soutiree_tempo_blanc_hc_cost
name: Tempo Blanc HC
color: lightgrey
- entity: sensor.linky_energie_soutiree_tempo_rouge_hp_cost
name: Tempo Rouge HP
color: red
- entity: sensor.linky_energie_soutiree_tempo_rouge_hc_cost
name: Tempo Rouge HC
color: darkred
- entity: sensor.solar_consumed_energy_daily
name: ÉCONOMIE
color: darkorange
invert: true
transform: return x * 0.2062;
- entity: sensor.grid_energy_returned
name: PERTE
color: yellow
invert: true
transform: return x * 0.2062;
- type: custom:apexcharts-card
graph_span: 365d
span:
end: month
cache: true
update_interval: 24h
stacked: true
header:
show: true
title: Suivi énergétique (kWh/month)
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
max: 900
apex_config:
tickAmount: 15
forceNiceScale: true
axisTicks:
show: false
all_series_config:
type: column
unit: kWh
float_precision: 2
show:
legend_value: false
statistics:
type: sum
period: month
align: middle
group_by:
func: diff
duration: 1month
start_with_last: true
fill: last
series:
- entity: sensor.solar_consumed_energy_daily
name: Production consommée
color: darkorange
- entity: sensor.linky_energie_soutiree_tempo_bleu_hp
name: Tempo Bleu HP
color: blue
- entity: sensor.linky_energie_soutiree_tempo_bleu_hc
name: Tempo Bleu HC
color: darkblue
- entity: sensor.linky_energie_soutiree_tempo_blanc_hp
name: Tempo Blanc HP
color: white
- entity: sensor.linky_energie_soutiree_tempo_blanc_hc
name: Tempo Blanc HC
color: lightgrey
- entity: sensor.linky_energie_soutiree_tempo_rouge_hp
name: Tempo Rouge HP
color: red
- entity: sensor.linky_energie_soutiree_tempo_rouge_hc
name: Tempo Rouge HC
color: darkred
- entity: sensor.grid_energy_returned
name: Production injectée
color: yellow
invert: true
- type: custom:apexcharts-card
graph_span: 365d
span:
end: month
cache: true
update_interval: 24hours
stacked: true
header:
show: true
title: Suivi énergétique (€/mois)
standard_format: true
apex_config:
chart:
height: 400px
yaxis:
- decimals: 0
min: -80
max: 80
apex_config:
tickAmount: 16
axisTicks:
show: false
all_series_config:
type: column
unit: €
float_precision: 2
show:
legend_value: false
statistics:
type: sum
period: month
align: middle
group_by:
duration: 1month
func: diff
start_with_last: true
fill: last
series:
- entity: sensor.linky_energie_soutiree_tempo_bleu_hp_cost
name: Tempo Bleu HP
color: blue
- entity: sensor.linky_energie_soutiree_tempo_bleu_hc_cost
name: Tempo Bleu HC
color: darkblue
- entity: sensor.linky_energie_soutiree_tempo_blanc_hp_cost
name: Tempo Blanc HP
color: white
- entity: sensor.linky_energie_soutiree_tempo_blanc_hc_cost
name: Tempo Blanc HC
color: lightgrey
- entity: sensor.linky_energie_soutiree_tempo_rouge_hp_cost
name: Tempo Rouge HP
color: red
- entity: sensor.linky_energie_soutiree_tempo_rouge_hc_cost
name: Tempo Rouge HC
color: darkred
- entity: sensor.solar_consumed_energy_daily
name: ÉCONOMIE
color: darkorange
invert: true
transform: return x * 0.2062;
- entity: sensor.grid_energy_returned
name: PERTE
color: yellow
invert: true
transform: return x * 0.2062;
@patmtp35
Copy link

bonjour merci pour tout ces supers outils mis a disposition !
J en suis a mes debut sur HA venant de jeedom , j'ai réussit a intégré qqes un de tes dev par contre la je cale.
le lovelace.yaml c'est a copier dans une card ?

@mathieucarbou
Copy link
Author

@patmtp35
Copy link

merci ! je vais tenter !

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