Hi all,
I tried to setup energy meter for France using pitinfo module and wemos D1.
Pitinfo data integration is working well, no problem with that.
In ESPHome config i have
sensors:
- platform: teleinfo
tag_name: "HCHC"
name: "Index heures creuses"
unit_of_measurement: "Wh"
icon: mdi:gauge
device_class: "ENERGY"
state_class: "total_increasing"
id: heures_creuses
- platform: teleinfo
tag_name: "HCHP"
name: "Index heures pleines"
unit_of_measurement: "Wh"
icon: mdi:gauge
device_class: "ENERGY"
state_class: "total_increasing"
id: heures_pleines
- platform: teleinfo
tag_name: "PTEC"
name: "Tarif en cours"
icon: mdi:clock-time-nine-outline
In ESPHome integration sensor.tarif_en_cours refers to PTEC, sensor.index_heures_creuses to HCHC and sensor.index_heures_pleines to HCHP.
In France we have 2 tariffs, on tariff change a signal (impulse) is sent to electricity network. (For HP and HC)
My wemos sends this value as sensor.tarif_en_cours. On HC the price must be 0.13/KWh, on HP it’s 0.1738 .
So i’ve done this in configuration.yaml
sensor:
- platform: template
sensors:
tarif_elec:
friendly_name: "Tarif Electricite"
unit_of_measurement: "/kWh"
value_template: >-
{%- if is_state('sensor.tarif_en_cours', 'HC..')
-%}
0.13
{%- else -%}
0.1738
{%- endif -%}
The value of tariff is good at the good moment. No problem with that.
I m getting one index in Wh for HP Tariff and another for HC Tariff (sensor.index_heures_creuses and sensor.index_heures_pleines)
So i did another sensor template to convert High price consumption and Low price consumption to kwh
total_elec_hc:
friendly_name: "Electricite totale consommee en HC"
unit_of_measurement: kWh
value_template: "{{ states('sensor.index_heures_creuses')|float / 1000}}"
total_elec_hp:
friendly_name: "Electricite totale consommee en HP"
unit_of_measurement: kWh
value_template: "{{ states('sensor.index_heures_pleines')|float / 1000}}"
And declared the utility meter
utility_meter:
compteur_elec_hc_journalier:
source: sensor.total_elec_hc
cycle: daily
compteur_elec_hp_journalier:
source: sensor.total_elec_hp
cycle: daily
I then added it to the energy configuration, linked to the tariff provided by tarif_elec
It works
The problem i have is that each time i reboot the Home Assistant core, compteur_elec_hp_journalier and compteur_elec_hc_journalier are taking as value my FULL consumption from the setup of my electricity network.
For example today
I think i’m missing something but i don’t know what. Price is good, but daily consumption is then totaly messed up each time i reboot.