Voici ton code comme l’attend le tutoriel :
# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:
# Stockage utility meter
utility_meter:
energy_total_usage_daily:
source: sensor.compteur_general_energy
cycle: daily
tariffs:
- day
- night
energy_total_usage_weekly:
source: sensor.compteur_general_energy
cycle: weekly
tariffs:
- day
- night
energy_total_usage_monthly:
source: sensor.compteur_general_energy
cycle: monthly
tariffs:
- day
- night
energy_total_usage_quarterly:
source: sensor.compteur_general_energy
cycle: quarterly
tariffs:
- day
- night
energy_total_usage_yearly:
source: sensor.compteur_general_energy
cycle: yearly
tariffs:
- day
- night
sensor:
- platform: template
sensors:
# consomation journaliere
energy_total_daily: # Consommation journalière HP + HC
friendly_name: 'Energie journaliere consommée'
entity_id:
- sensor.energy_total_usage_daily_day
- sensor.energy_total_usage_daily_night
value_template: "{{ (states('sensor.energy_total_usage_daily_day')|float + states('sensor.energy_total_usage_daily_night')|float)|round(3) }}"
unit_of_measurement: "kWh"
- platform: template
sensors:
# consommation semaine
energy_total_weekly:# Consommation semaine HP + HC
friendly_name: 'Energie semaine consommée'
entity_id:
- sensor.energy_total_usage_weekly_day
- sensor.energy_total_usage_weekly_night
value_template: "{{ (states('sensor.energy_total_usage_weekly_day')|float + states('sensor.energy_total_usage_weekly_night')|float)|round(3) }}"
unit_of_measurement: "kWh"
- platform: template
sensors:
# Consommation du moi
energy_total_monthly:# Consommation moi HP + HC
friendly_name: 'Energie du moi consommée'
entity_id:
- sensor.energy_total_usage_monthly_day
- sensor.energy_total_usage_monthly_night
value_template: "{{ (states('sensor.energy_total_usage_monthly_day')|float + states('sensor.energy_total_usage_monthly_night')|float)|round(3) }}"
unit_of_measurement: "kWh"
- platform: template
sensors:
# consomation Trimestrielle
energy_total_quarterly:# Consommation trimestrielle HP + HC
friendly_name: 'Energie trimestrielle consommée'
entity_id:
- sensor.energy_total_usage_quarterly_day
- sensor.energy_total_usage_quarterly_night
value_template: "{{ (states('sensor.energy_total_usage_quarterly_day')|float + states('sensor.energy_total_usage_quarterly_night')|float)|round(3) }}"
unit_of_measurement: "kWh"
- platform: template
sensors:
# consomation de l'année
energy_total_yearly: # Consommation de l'année HP + HC
friendly_name: 'Energie de l année consommée'
entity_id:
- sensor.energy_total_usage_yearly_day
- sensor.energy_total_usage_yearly_night
value_template: "{{ (states('sensor.energy_total_usage_yearly_day')|float + states('sensor.energy_total_usage_yearly_night')|float)|round(3) }}"
unit_of_measurement: "kWh"
- platform: template
# sensor pour mettre en euros par jour
sensors:
hp_cost_today:# Coût journalier HP
friendly_name: 'HP Cost Today'
entity_id:
- sensor.energy_total_usage_daily_day
- input_number.hp_daily_cost
- input_number.hp_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_daily_day')|float * states('input_number.hp_energy_cost')|float + states('input_number.hp_daily_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
hc_cost_today:# Coût journalier HC
friendly_name: 'HC Cost Today'
entity_id:
- sensor.energy_total_usage_daily_night
- input_number.hc_daily_cost
- input_number.hc_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_daily_night')|float * states('input_number.hc_energy_cost')|float + states('input_number.hc_daily_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
cost_today:# Coût journalier HP + HC
friendly_name: "Aujourd'hui"
entity_id:
- sensor.hp_cost_today
- sensor.hc_cost_today
value_template: "{{ (states('sensor.hp_cost_today')|float + states('sensor.hc_cost_today')|float)|round(2) }}"
unit_of_measurement: "€"
# sensor pour mettre en euros par semaine
- platform: template
sensors:
hp_cost_weekly:# Coût semaine HP
friendly_name: 'HP Cost semaine'
entity_id:
- sensor.energy_total_usage_weekly_day
- input_number.hp_daily_cost
- input_number.hp_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_weekly_day')|float * states('input_number.hp_energy_cost')|float + states('input_number.hp_weekly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
hc_cost_weekly:# Coût semaine HC
friendly_name: 'HC Cost semaine'
entity_id:
- sensor.energy_total_usage_weekly_night
- input_number.hc_daily_cost
- input_number.hc_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_weekly_night')|float * states('input_number.hc_energy_cost')|float + states('input_number.hc_weekly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
cost_weekly:# Coût semaine HP + HC
friendly_name: "semaine"
entity_id:
- sensor.hp_cost_weekly
- sensor.hc_cost_weekly
value_template: "{{ (states('sensor.hp_cost_weekly')|float + states('sensor.hc_cost_weekly')|float)|round(2) }}"
unit_of_measurement: "€"
# sensor pour mettre en euros par moi
- platform: template
sensors:
hp_cost_monthly:# Coût par moi HP
friendly_name: 'HP Cost monthly'
entity_id:
- sensor.energy_total_usage_monthly_day
- input_number.hp_daily_cost
- input_number.hp_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_monthly_day')|float * states('input_number.hp_energy_cost')|float + states('input_number.hp_monthly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
hc_cost_monthly:# Coût par moi HC
friendly_name: 'HC Cost monthly'
entity_id:
- sensor.energy_total_usage_monthly_night
- input_number.hc_daily_cost
- input_number.hc_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_monthly_night')|float * states('input_number.hc_energy_cost')|float + states('input_number.hc_monthly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
cost_monthly:# Coût par moi HP + HC
friendly_name: "Le moi"
entity_id:
- sensor.hp_cost_monthly
- sensor.hc_cost_monthly
value_template: "{{ (states('sensor.hp_cost_monthly')|float + states('sensor.hc_cost_monthly')|float)|round(2) }}"
unit_of_measurement: "€"
# sensor pour mettre en euros par trimestre
- platform: template
sensors:
hp_cost_quarterly:# Coût par trimestre HP
friendly_name: 'HP Cost quarterly'
entity_id:
- sensor.energy_total_usage_quarterly_day
- input_number.hp_daily_cost
- input_number.hp_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_quarterly_day')|float * states('input_number.hp_energy_cost')|float + states('input_number.hp_quarterly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
hc_cost_quarterly:# Coût par trimestre HC
friendly_name: 'HC Cost quarterly'
entity_id:
- sensor.energy_total_usage_quarterly_night
- input_number.hc_daily_cost
- input_number.hc_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_quarterly_night')|float * states('input_number.hc_energy_cost')|float + states('input_number.hc_quarterly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
cost_quarterly:# Coût par trimestre HP + HC
friendly_name: "Le trimestre"
entity_id:
- sensor.hp_cost_quarterly
- sensor.hc_cost_quarterly
value_template: "{{ (states('sensor.hp_cost_quarterly')|float + states('sensor.hc_cost_quarterly')|float)|round(2) }}"
unit_of_measurement: "€"
# sensor pour mettre en euros par année
- platform: template
sensors:
hp_cost_yearly:# Coût par année HP
friendly_name: 'HP Cost yearly'
entity_id:
- sensor.energy_total_usage_yearly_day
- input_number.hp_daily_cost
- input_number.hp_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_yearly_day')|float * states('input_number.hp_energy_cost')|float + states('input_number.hp_yearly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
hc_cost_yearly:# Coût par année HC
friendly_name: 'HC Cost yearly'
entity_id:
- sensor.energy_total_usage_yearly_night
- input_number.hc_daily_cost
- input_number.hc_energy_cost
value_template: "{{ (states('sensor.energy_total_usage_yearly_night')|float * states('input_number.hc_energy_cost')|float + states('input_number.hc_yearly_cost')|float)|round(2) }}"
unit_of_measurement: "€"
- platform: template
sensors:
cost_yearly:# Coût par année HP + HC
friendly_name: "L année"
entity_id:
- sensor.hp_cost_yearly
- sensor.hc_cost_yearly
value_template: "{{ (states('sensor.hp_cost_yearly')|float + states('sensor.hc_cost_yearly')|float)|round(2) }}"
unit_of_measurement: "€"
# entrees
input_number:
hp_daily_cost:
name: HP - Cout journalier
mode: box
min: 0
max: 100
unit_of_measurement: "€/day"
icon: mdi:currency-eur
hp_energy_cost:
name: HP - Coût du Kwh
mode: box
min: 0
max: 100
unit_of_measurement: "€/kWh"
icon: mdi:currency-eur
hc_daily_cost:
name: HC - Cout journalier
mode: box
min: 0
max: 100
unit_of_measurement: "€/day"
icon: mdi:currency-eur
hc_energy_cost:
name: HC - Coût du Kwh
mode: box
min: 0
max: 100
unit_of_measurement: "€/kWh"
icon: mdi:currency-eur
# Text to speech
tts:
- platform: google_translate
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml