Emporia gen2 avec esphome

Bonjour à tous

J’essaye desesperement de faire fonctionner correctement mon emporia gen2 sur esphome et homeassistant.
Je me retrouve avec des valeurs completement erronées sur chacun des circuits, les puissances mesurées sont irrealistes
Ci dessous mon code, si une bonne ame peut venir à mon aide, merci! j’ai enlevé les infos perso bien sur…

esphome:
  name: emporia-vue
  friendly_name: emporia_vue

esp32:
  board: esp32dev
  framework:
    type: esp-idf

external_components:
  - source:
      type: git
      url: https://github.com/emporia-vue-local/esphome
      ref: vue3
    components: [ emporia_vue ]

logger:
  level: INFO

wifi:
  ssid: 
  password: 

api:
  encryption: 

ota:
  - platform: esphome
    password:

i2c:
  - id: i2c_a
    sda: 21
    scl: 22
    scan: true

sensor:
  - platform: emporia_vue
    i2c_id: i2c_a
    phases:
      - id: phase_a
        input: BLACK
        calibration: 0.022
        voltage: { name: "Tension Secteur" }
        frequency: { name: "Fréquence Secteur" }

    ct_clamps:
      # --- PORT C : LECTURE UNIQUE (Point critique du GitHub) ---
      - phase_id: phase_a
        input: "C"
        power:
          id: main_power_raw
          name: "Puissance Totale"
          filters:
            - multiply: -8.0 
            - sliding_window_moving_average: { window_size: 10, send_every: 5 }

      # --- LES 16 CIRCUITS (Lecture unique par port) ---
      - { phase_id: phase_a, input: "1", power: { id: cir1, name: "Chauffe-eau" } }
      - { phase_id: phase_a, input: "2", power: { id: cir2, name: "Prise VE" } }
      - { phase_id: phase_a, input: "3", power: { id: cir3, name: "Chauffage" } }
      - { phase_id: phase_a, input: "4", power: { id: cir4, name: "Production PV" } }
      - { phase_id: phase_a, input: "5", power: { id: cir5, name: "Sèche-linge" } }
      - { phase_id: phase_a, input: "6", power: { id: cir6, name: "Plaque" } }
      - { phase_id: phase_a, input: "7", power: { id: cir7, name: "Lave-linge" } }
      - { phase_id: phase_a, input: "8", power: { id: cir8, name: "Four" } }
      - { phase_id: phase_a, input: "9", power: { id: cir9, name: "Circuit 9" } }
      - { phase_id: phase_a, input: "10", power: { id: cir10, name: "Circuit 10" } }
      - { phase_id: phase_a, input: "11", power: { id: cir11, name: "Circuit 11" } }
      - { phase_id: phase_a, input: "12", power: { id: cir12, name: "Circuit 12" } }
      - { phase_id: phase_a, input: "13", power: { id: cir13, name: "Circuit 13" } }
      - { phase_id: phase_a, input: "14", power: { id: cir14, name: "Circuit 14" } }
      - { phase_id: phase_a, input: "15", power: { id: cir15, name: "Circuit 15" } }
      - { phase_id: phase_a, input: "16", power: { id: cir16, name: "Circuit 16" } }

  # --- LOGIQUE CALCULÉE (Découplée du matériel) ---
  - platform: template
    name: "Puissance Import"
    id: power_import
    unit_of_measurement: "W"
    device_class: power
    lambda: 'return max(id(main_power_raw).state, 0.0f);'
    update_interval: 2s

  - platform: template
    name: "Puissance Return"
    id: power_return
    unit_of_measurement: "W"
    device_class: power
    lambda: 'return max(-id(main_power_raw).state, 0.0f);'
    update_interval: 2s

  - platform: template
    name: "Consommation Totale Maison"
    unit_of_measurement: "W"
    device_class: power
    lambda: 'return id(cir4).state + id(main_power_raw).state;'
    update_interval: 2s

Bonjour Cedric, pas le temps de voir ce qu’ill vas pas dans ton code, mais voici le mien qui fonctionne tres bien (je suis en mono-phase):

esphome:
  name: emporiavue2
  friendly_name: Emporia Vue2

external_components:
  - source: github://emporia-vue-local/esphome@dev
    components:
      - emporia_vue

esp32:
  board: esp32dev
  framework:
    type: esp-idf
    version: recommended

# Enable Home Assistant API
api:
  encryption:
    key: "xxxxxxxxxxxxxxxxxx"

  services:
    - service: play_rtttl
      variables:
        song_str: string
      then:
        - rtttl.play:
            rtttl: !lambda 'return song_str;'

ota:
- platform: esphome
  password: "xxxxx"

# Enable logging
logger:
  logs:
    # by default, every reading will be printed to the UART, which is very slow
    # This will disable printing the readings but keep other helpful messages
    sensor: INFO

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

preferences:
  # the default of 1min is far too short--flash chip is rated
  # for approx 100k writes.
  flash_write_interval: "48h"

output:
  - platform: ledc
    pin: GPIO12
    id: buzzer
  - platform: gpio
    pin: GPIO27
    id: buzzer_gnd

rtttl:
  output: buzzer
  on_finished_playback:
    - logger.log: 'Song ended!'

button:
  - platform: template
    name: "Two Beeps"
    on_press:
      - rtttl.play: "two short:d=4,o=5,b=100:16e6,16e6"

light:
  - platform: status_led
    name: "D3_LED"
    pin: 23
    restore_mode: ALWAYS_ON
    entity_category: config

i2c:
  sda: 21
  scl: 22
  scan: false
  frequency: 400kHz
  timeout: 1ms
  id: i2c_a

time:
  - platform: sntp
    id: my_time

# these are called references in YAML. They allow you to reuse
# this configuration in each sensor, while only defining it once
.defaultfilters:
  - &throttle_avg
    # average all raw readings together over a 5 second span before publishing
    throttle_average: 5s
  - &throttle_time
    # only send the most recent measurement every 60 seconds
    throttle: 60s
  - &moving_avg
    # we capture a new sample every 0.24 seconds, so the time can
    # be calculated from the number of samples as n * 0.24.
    sliding_window_moving_average:
      # we average over the past 2.88 seconds * 2
      window_size: 24
      # we push a new value every 1.44 seconds * 2
      send_every: 12
  - &invert
    # invert and filter out any values below 0.
    lambda: 'return max(-x, 0.0f);'
  - &pos
    # filter out any values below 0.
    lambda: 'return max(x, 0.0f);'
  - &abs
    # take the absolute value of the value
    lambda: 'return abs(x);'

sensor:
  - platform: emporia_vue
    i2c_id: i2c_a
    phases:
      - id: phase_a  # Verify that this specific phase/leg is connected to correct input wire color on device listed below
        input: BLACK  # Vue device wire color
        calibration: 0.0221  # 0.022 is used as the default as starting point but may need adjusted to ensure accuracy
        # To calculate new calibration value use the formula <in-use calibration value> * <accurate voltage> / <reporting voltage>
        voltage:
          name: "General Voltage"
          filters: [*throttle_avg, *pos]
        frequency:
          name: "General Frequency"
          filters: [*throttle_avg, *pos]
    ct_clamps:
      - phase_id: phase_a
        input: "A"  # Verify the CT going to this device input also matches the phase/leg
        power:
          name: "Phase A Power"
          id: phase_a_power
          device_class: power
          filters: [*throttle_avg, *pos]
      - phase_id: phase_a
        input: "B"  # Verify the CT going to this device input also matches the phase/leg
        power:
          name: "Phase B Power"
          id: phase_b_power
          device_class: power
          filters: [*throttle_avg, *pos]
      - phase_id: phase_a
        input: "C"  # Verify the CT going to this device input also matches the phase/leg
        power:
          name: "Phase C Power"
          id: phase_c_power
          device_class: power
          filters: [*throttle_avg, *pos]
      # Pay close attention to set the phase_id for each breaker by matching it to the phase/leg it connects to in the panel
      - { phase_id: phase_a, input:  "1", power: { name:  "Circuit 1 Power", id:  cir1, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "2", power: { name:  "Circuit 2 Power", id:  cir2, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "3", power: { name:  "Circuit 3 Power", id:  cir3, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "4", power: { name:  "Circuit 4 Power", id:  cir4, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "5", power: { name:  "Circuit 5 Power", id:  cir5, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "6", power: { name:  "Circuit 6 Power", id:  cir6, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "7", power: { name:  "Circuit 7 Power", id:  cir7, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "8", power: { name:  "Circuit 8 Power", id:  cir8, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input:  "9", power: { name:  "Circuit 9 Power", id:  cir9, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "10", power: { name: "Circuit 10 Power", id: cir10, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "11", power: { name: "Circuit 11 Power", id: cir11, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "12", power: { name: "Circuit 12 Power", id: cir12, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "13", power: { name: "Circuit 13 Power", id: cir13, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "14", power: { name: "Circuit 14 Power", id: cir14, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "15", power: { name: "Circuit 15 Power", id: cir15, filters: [*throttle_avg, *pos] } }
      - { phase_id: phase_a, input: "16", power: { name: "Circuit 16 Power", id: cir16, filters: [*throttle_avg, *pos] } }
  - { power_id: phase_a_power, platform: total_daily_energy, accuracy_decimals: 0, name: "Total Daily Energy" }
  - { power_id: phase_b_power, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit B Daily Energy" }
  - { power_id: phase_c_power, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit C Daily Energy" }
  - { power_id:  cir1, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 1 Daily Energy" }
  - { power_id:  cir2, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 2 Daily Energy" }
  - { power_id:  cir3, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 3 Daily Energy" }
  - { power_id:  cir4, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 4 Daily Energy" }
  - { power_id:  cir5, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 5 Daily Energy" }
  - { power_id:  cir6, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 6 Daily Energy" }
  - { power_id:  cir7, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 7 Daily Energy" }
  - { power_id:  cir8, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 8 Daily Energy" }
  - { power_id:  cir9, platform: total_daily_energy, accuracy_decimals: 0, name:  "Circuit 9 Daily Energy" }
  - { power_id: cir10, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 10 Daily Energy" }
  - { power_id: cir11, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 11 Daily Energy" }
  - { power_id: cir12, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 12 Daily Energy" }
  - { power_id: cir13, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 13 Daily Energy" }
  - { power_id: cir14, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 14 Daily Energy" }
  - { power_id: cir15, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 15 Daily Energy" }
  - { power_id: cir16, platform: total_daily_energy, accuracy_decimals: 0, name: "Circuit 16 Daily Energy" }

Bonne journee

Super, merci beaucoup, ca fonctionne nickel !

1 « J'aime »