# Zlinky - Consommation instantanée / quotidienne / hebdomadaire / mensuel

**URL:** <https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879>\
**Category:** Entraide Home Assistant\
**Tags:** mini-graph-card, linky, tableau-de-bord-dashboard\
**Created:** [Février 19, 2024, 12:27 UTC](https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879 "2024-02-19T12:27:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![WaWaToR](https://forum.hacf.fr/user_avatar/forum.hacf.fr/wawator/32/56003_2.png) [@WaWaToR](https://forum.hacf.fr/u/WaWaToR)\
**Post date:** [Février 19, 2024, 12:27 UTC](https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879/1 "2024-02-19T12:27:03Z")

</div>

## Zlinky - Consommation instantanée / quotidienne / hebdomadaire / mensuel

Bonjour, tout le monde,  
J'espère que vous allez bien ?  
J'aurais besoin de votre aide pour mettre en valeur mes données Zlinky.

J'ai depuis quelques jours un Zlinky qui est connecté sur mon Raspberry Pi4 avec Home Assistant.

J'aimerais afficher ma **consommation instantanée / quotidienne / hebdomadaire / mensuel** mais je n'ai pas ces données dans la liste des capteurs :

 ![Capture d'écran 2024-02-18 212152](https://forum.hacf.fr/uploads/default/original/3X/b/e/be8e6719bac32209fcd1a07022ff50b3ae560906.png)

Voici ce que je cherche à faire :

 ![Capture d'écran 2024-02-19 132348](https://forum.hacf.fr/uploads/default/original/3X/7/6/76ced04a2a253cd13da74483e50b4a4a0bf59958.png)

Je veux aussi utiliser ces données pour faire des graphiques

Merci beaucoup pour votre aide !  
Bonne journée

---

<div class="post-metadata">

**Author:** ![WarC0zes](https://forum.hacf.fr/user_avatar/forum.hacf.fr/warc0zes/32/137471_2.png) [@WarC0zes](https://forum.hacf.fr/u/WarC0zes)\
**Post date:** [Février 19, 2024, 1:00 UTC](https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879/2 "2024-02-19T13:00:17Z")

</div>

Bonjour,  
ta ce post qui reprends ce que tu cherche a faire. Faut utiliser `utility_meter`.

> **[Utility Meter](https://www.home-assistant.io/integrations/utility_meter/)**
>
> Instructions on how to integrate the Utility Meter into Home Assistant.

> [@\[ENERGIE\] Suivi consommation Linky](https://forum.hacf.fr/t/energie-suivi-consommation-linky/28561/1):
>
> Ensuite, fichier configuration.yaml pour utility meter et hp/hc:
> 
> ```auto
> # Daily energy
> daily_energy:
> source: sensor.zlinky_tic_east
> name: Daily Energy
> cycle: daily
> tariffs:
> - hp
> - hc
> # Weekly energy
> weekly_energy:
> source: sensor.zlinky_tic_east
> name: Weekly Energy
> cycle: weekly
> tariffs:
> - hp
> - hc
> # Monthly energy
> monthly_energy:
> source: sensor.zlinky_tic_east
> name: Monthly Energy
> cycle: monthly
> tariffs:
> - hp
> - hc
> # Yearly energy
> yearly_energy:
> source: sensor.zlinky_tic_east
> name: Yearly Energy
> cycle: yearly
> tariffs:
> - hp
> - hc
> 
> ```
> 
> J’ai créé une automation pour changé les hc et hp:
> 
> ```auto
> alias: HeurePleine - HeureCreuse
> description: ""
> trigger:
> - platform: time
> at: "05:34:00"
> variables:
> tariff: hp
> - platform: time
> at: "21:34:00"
> variables:
> tariff: hc
> condition: []
> action:
> - service: select.select_option
> target:
> entity_id: sensor.daily_total_energy
> data:
> option: "{{ tariff }}"
> - service: select.select_option
> target:
> entity_id: sensor.weekly_total_energy
> data:
> option: "{{ tariff }}"
> - service: select.select_option
> target:
> entity_id: sensor.monthly_total_energy
> data:
> option: "{{ tariff }}"
> - service: select.select_option
> target:
> entity_id: sensor.yearly_total_energy
> data:
> option: "{{ tariff }}"
> mode: single
> 
> ```
> 
> J’ai également ajouté dess sensor conso et pourcentage:
> 
> ```auto
> # Daily energy heure creuse
> daily_total_energy:
> friendly_name: "Energie journalière consommée"
> unit_of_measurement: "kWh"
> value_template: "{{ (states('sensor.daily_energy_hp') | float + states('sensor.daily_energy_hc') | float) | round(2) }}"
> # Weekly energy
> weekly_total_energy:
> friendly_name: "Energie hebdo consommée"
> unit_of_measurement: "kWh"
> value_template: "{{ (states('sensor.weekly_energy_hp') | float + states('sensor.weekly_energy_hc') | float) | round(2) }}"
> # Monthly energy
> monthly_total_energy:
> friendly_name: "Energie mensuelle consommée"
> unit_of_measurement: "kWh"
> value_template: "{{ (states('sensor.monthly_energy_hp') | float + states('sensor.monthly_energy_hc') | float) | round(2) }}"
> # Yearly energy
> yearly_total_energy:
> friendly_name: "Energie annuelle consommée"
> unit_of_measurement: "kWh"
> value_template: "{{ (states('sensor.yearly_energy_hp') | float + states('sensor.yearly_energy_hc') | float) | round(2) }}"
> # HP / HC
> hp_hc:
> friendly_name: "Energie mensuelle € hp+hc"
> unit_of_measurement: "€"
> value_template: "{{ ((((states('sensor.monthly_energy_hp') | float) *
> states('input_number.prix_hp') | float) + (( states('sensor.monthly_energy_hc') | float) * states('input_number.prix_hc') | float)) + states('input_number.prix_abo_hchp') | float ) | round (3) }}"
> # Mensuel
> mensuel:
> friendly_name: "Energie mensuelle"
> value_template: "{{ states('sensor.monthly_energy_hp') }} HC et {{ states('sensor.monthly_energy_hc') }} HP"
> # HP / HC Pourcentage
> hc_hp:
> friendly_name: "Pourcentage"
> value_template: >-
> {% set hchp = (states('sensor.monthly_energy_hc') | float) / ((states('sensor.monthly_energy_hp') | float) + (states('sensor.monthly_energy_hc') | float)) %} {% if hchp <= 1 %} {{ hchp| round(2)}} % d'heures creuses {% endif %}
> 
> ```
> 
> Et pour terminer j’ai ajouté des input\_number:
> 
> ```auto
> # Prix heure pleine
> prix_hp:
> name: Prix hp
> initial: 0.2228
> min: 0
> max: 1
> step: 0.0001
> mode: box
> icon: mdi:currency-eur
> unit_of_measurement: "€"
> # Prix heure creuse
> prix_hc:
> name: Prix hc
> initial: 0.1615
> min: 0
> max: 1
> step: 0.0001
> mode: box
> icon: mdi:currency-eur
> unit_of_measurement: "€"
> # Prix abonnement heure creuse / heure pleine
> prix_abo_hchp:
> name: Prix abo hchp
> initial: 15.99
> min: 10
> max: 20
> step: 0.01
> mode: box
> icon: mdi:currency-eur
> unit_of_measurement: "€"
> # Contribution au service Public d'Electricite
> prix_cspe:
> name: Prix cspe
> initial: 0.00100
> min: 0
> max: 1
> step: 0.00001
> mode: box
> icon: mdi:currency-eur
> unit_of_measurement: "€"
> # Contribution Tarifaire d'Acheminement Electricité
> prix_cta:
> name: Prix cta
> initial: 0.0012
> min: 0
> max: 1
> step: 0.0001
> mode: box
> icon: mdi:currency-eur
> unit_of_measurement: "€"
> 
> ```

---

<div class="post-metadata">

**Author:** ![WaWaToR](https://forum.hacf.fr/user_avatar/forum.hacf.fr/wawator/32/56003_2.png) [@WaWaToR](https://forum.hacf.fr/u/WaWaToR)\
**Post date:** [Février 19, 2024, 1:20 UTC](https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879/3 "2024-02-19T13:20:37Z")

</div>

Merci pour ton retour,  
Peux-tu me confirmer ce que je dois utiliser pour avoir : sensor.zlinky\_tic\_east ?

Car je n’ai pas ça

---

<div class="post-metadata">

**Author:** ![WarC0zes](https://forum.hacf.fr/user_avatar/forum.hacf.fr/warc0zes/32/137471_2.png) [@WarC0zes](https://forum.hacf.fr/u/WarC0zes)\
**Post date:** [Février 19, 2024, 2:54 UTC](https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879/4 "2024-02-19T14:54:46Z")

</div>

Ta pas une entité avec le total de kWh ( HP+HC)?

Sinon, tu peut créer un template qui additonne les HP + HC et tu utilisera c'est entité template comme source pour les utility\_meter.

Faut ajouter c'est ligne `template: !include template.yaml` dans le configuration.yaml.  
Creér un fichier template.yaml dans /config et coller le code ci dessous ( modifier les entités ).

```auto
- sensor:
    - name: zlinky_metering_HC_HP_sum
      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total_increasing
      state: >-
          {% set HC = states('sensor.0x00158d0005d299cf_hchc')|float(default=0) %}
          {% set HP = states('sensor.0x00158d0005d299cf_hchp')|float(default=0) %}
          {{ HC + HP | int(default=0) }}
      availability: "{{ states('sensor.0x00158d0005d299cf_hchc')|is_number and states('sensor.0x00158d0005d299cf_hchp')|is_number }}"

```

edit:  
petit précision, pour le post source de [Thomas\_Mary](https://forum.hacf.fr/u/Thomas_Mary).  
Il utilise des template sensor, mais l'ancien format. Si tu créer ces templates faut les convertir au nouveau format ( comme l'exemple du template que j'ai mis plus haut).

> **[Template](https://www.home-assistant.io/integrations/template/)**
>
> Instructions on how to create template entities in Home Assistant.

---

<div class="post-metadata">

**Author:** ![anon51798830](https://forum.hacf.fr/letter_avatar_proxy/v4/letter/a/ce7236/32.png) [@anon51798830](https://forum.hacf.fr/u/anon51798830)\
**Post date:** [Février 19, 2024, 3:18 UTC](https://forum.hacf.fr/t/zlinky-consommation-instantanee-quotidienne-hebdomadaire-mensuel/36879/5 "2024-02-19T15:18:42Z")

</div>

Message supprimé par son auteur
