Suivi du coût HC/HP dans le dashboard energy

Mon problème

Bonjour,
J’ai mis en place des pinces ampermétrique Shelly pour suivre ma conso electrique.
Je suis en mode heure pleine / heure creuse et j’aurais souhaité pouvoir « donner » au dashboard energie le coût au kwh en fonction de l’heure et du jour (pour ma part je suis en HC de 1h30 à 7h30 et de 13h a 15 ainsi que les mercredi et weekend.

Et je ne sais pas du tout comment faire ça.
Un script ? un helper ?

Ma configuration


[center]## System Information

version core-2022.8.4
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.10.5
os_name Linux
os_version 5.10.0-16-amd64
arch x86_64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4982
Installed Version 1.26.2
Stage running
Available Repositories 1198
Downloaded Repositories 17
Home Assistant Cloud
logged_in true
subscription_expiration March 9, 2023 at 1:00 AM
relayer_connected true
remote_enabled true
remote_connected true
alexa_enabled false
google_enabled true
remote_server eu-central-1-4.ui.nabu.casa
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Dashboards
dashboards 6
resources 8
views 9
mode storage
Recorder
oldest_recorder_run January 26, 2023 at 10:11 PM
current_recorder_run January 26, 2023 at 11:11 PM
estimated_db_size 530.57 MiB
database_engine sqlite
database_version 3.38.5
Spotify
api_endpoint_reachable ok
[/center]

Bonjour

il vous faut mettre en place un utility meter

Home Assistant

Utility Meter

Instructions on how to integrate the Utility Meter into Home Assistant.

et plus particulierement la configuration avancée

Advanced Configuration

The following configuration shows an example where 2 utility_meters (daily_energy and monthly_energy) track daily and monthly energy consumptions.

Both track the same sensor (sensor.energy) which continuously monitors the energy consumed.

4 different sensors will be created, 2 per utility meter and corresponding to each tariff. Sensor sensor.daily_energy_peak, sensor.daily_energy_offpeak, sensor.monthly_energy_peak and sensor.monthly_energy_offpeak will automatically be created to track the consumption in each tariff for the given cycle.

The select.daily_energy and select.monthly_energy select entities will track the current tariff and allow changing the tariff.

utility_meter:
  daily_energy:
    source: sensor.energy
    name: Daily Energy
    cycle: daily
    tariffs:
      - peak
      - offpeak
  monthly_energy:
    source: sensor.energy
    name: Monthly Energy
    cycle: monthly
    tariffs:
      - peak
      - offpeak

YAML

Copy

Assuming your energy provider tariffs are time based according to:

  • peak: from 06:08 to 12:38 and 15:38 to 01:08
  • offpeak: from 01:08 to 06:08 and 12:38 to 15:38

a time based automation can be used:

automation:
  trigger:
    - platform: time
      at: "01:08:00"
      variables:
        tariff: offpeak
    - platform: time
      at: "06:08:00"
      variables:
        tariff: peak
    - platform: time
      at: "12:38:00"
      variables:
        tariff: offpeak
    - platform: time
      at: "15:38:00"
      variables:
        tariff: peak
    action:
    - service: select.select_option
      target:
        entity_id: select.daily_energy
      data:
        option: "{{ tariff }}"
    - service: select.select_option
      target:
        entity_id: select.monthly_energy
      data:
        option: "{{ tariff }}"

vous aurez automatiquement une ségrégation des valeurs de consommation HP HC qui sera intégrable directement dans le module energy de HA

Merci pour ta réponse cela m’a bien aidé.
Voici ma conf qui semble super bien fonctionner :

Sachant que j’ai défini un Calendar de type helper avec les bon créneaux.

Pour que tout fonctionne j’ai fait un package :
configuration.yaml :

homeassistant:
  packages: !include_dir_named packages

packages/edf.yaml :

utility_meter:
  daily_energy:
    source: sensor.shellyem_production_consommation_channel_1_energy
    name: Consommation EDF - J
    cycle: daily
    tariffs:
      - HP
      - HC
  monthly_energy:
    source: sensor.shellyem_production_consommation_channel_1_energy
    name: Consommation EDF - M
    cycle: monthly
    tariffs:
      - HP
      - HC
automation:
  alias: "Heures Creuses - Heures Pleines"
  trigger:
    - platform: calendar
      event: start
      offset: 0:0:0
      entity_id: schedule.hc_schedule
      variables:
        tariff: "HC"
    - platform: calendar
      event: stop
      offset: 0:0:0
      entity_id: schedule.hc_schedule
      variables:
        tariff: "HP"
  action:
    - service: select.select_option
      target:
        entity_id: select.daily_energy
      data:
        option: "{{ tariff }}"
    - service: select.select_option
      target:
        entity_id: select.monthly_energy
      data:
        option: "{{ tariff }}"

Cool je connaissais pas les packages ça va me plaire pour les split configuration