substitutions: device_name: emp-vue2-2 dn: emp-vue2-2 friendly_name: Emporia Vue2 2 cir01name: Range-Hood cir01phase: phase_a cir01mult: "1" cir02name: AC1 cir02phase: phase_a cir02mult: "2" cir03name: Kit-GFI cir03phase: phase_b cir03mult: "1" cir04name: Current-Monitor cir04phase: phase_a cir04mult: "1" cir05name: Surge cir05phase: phase_a cir05mult: "1" cir06name: MBR-Server cir06phase: phase_b cir06mult: "1" cir07name: Current-Monitor cir07phase: phase_b cir07mult: "1" cir08name: Microwave cir08phase: phase_a cir08mult: "1" cir09name: AC2 #TODO cir09phase: phase_a cir09mult: "2" cir10name: Kit-GFI cir10phase: phase_b cir10mult: "1" cir11name: Dining-Plugs cir11phase: phase_b cir11mult: "1" cir12name: None cir12phase: phase_a cir12mult: "1" cir13name: None cir13phase: phase_b cir13mult: "1" cir14name: None cir14phase: phase_a cir14mult: "1" cir15name: None cir15phase: phase_b cir15mult: "1" cir16name: None cir16phase: phase_a cir16mult: "1" <<: !include .wifi-oss.yaml esphome: name: ${device_name} friendly_name: ${friendly_name} 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: # Encryption key is generated by the new device wizard. # key: "" services: - service: play_rtttl variables: song_str: string then: - rtttl.play: rtttl: !lambda 'return song_str;' ota: # Create a secure password for pushing OTA updates. # password: "" # Enable logging logger: 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: 200kHz # recommended range is 50-200kHz 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: - &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 window_size: 12 # we push a new value every 1.44 seconds send_every: 6 - &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.022 # 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 * / voltage: name: "Phase A Voltage" filters: [*moving_avg, *pos] frequency: name: "Phase A Frequency" filters: [*moving_avg, *pos] - id: phase_b # Verify that this specific phase/leg is connected to correct input wire color on device listed below input: RED # Vue device wire color calibration: 0.022 # 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 * / voltage: name: "Phase B Voltage" filters: [*moving_avg, *pos] phase_angle: name: "Phase B Phase Angle" filters: [*moving_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 filters: [*moving_avg, *pos] - phase_id: phase_b input: "B" # Verify the CT going to this device input also matches the phase/leg power: name: "Phase B Power" id: phase_b_power filters: [*moving_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: "${cir01phase}", input: "1", power: { name: "${cir01name} Power", id: cir01, filters: [ *moving_avg, *pos, multiply: "${cir01mult}" ] } } - { phase_id: "${cir02phase}", input: "2", power: { name: "${cir02name} Power", id: cir02, filters: [ *moving_avg, *pos, multiply: "${cir02mult}" ] } } - { phase_id: "${cir03phase}", input: "3", power: { name: "${cir03name} Power", id: cir03, filters: [ *moving_avg, *pos, multiply: "${cir03mult}" ] } } - { phase_id: "${cir04phase}", input: "4", power: { name: "${cir04name} Power", id: cir04, filters: [ *moving_avg, *pos, multiply: "${cir04mult}" ] } } - { phase_id: "${cir05phase}", input: "5", power: { name: "${cir05name} Power", id: cir05, filters: [ *moving_avg, *pos, multiply: "${cir05mult}" ] } } - { phase_id: "${cir06phase}", input: "6", power: { name: "${cir06name} Power", id: cir06, filters: [ *moving_avg, *pos, multiply: "${cir06mult}" ] } } - { phase_id: "${cir07phase}", input: "7", power: { name: "${cir07name} Power", id: cir07, filters: [ *moving_avg, *pos, multiply: "${cir07mult}" ] } } - { phase_id: "${cir08phase}", input: "8", power: { name: "${cir08name} Power", id: cir08, filters: [ *moving_avg, *pos, multiply: "${cir08mult}" ] } } - { phase_id: "${cir09phase}", input: "9", power: { name: "${cir09name} Power", id: cir09, filters: [ *moving_avg, *pos, multiply: "${cir09mult}" ] } } - { phase_id: "${cir10phase}", input: "10", power: { name: "${cir10name} Power", id: cir10, filters: [ *moving_avg, *pos, multiply: "${cir10mult}" ] } } - { phase_id: "${cir11phase}", input: "11", power: { name: "${cir11name} Power", id: cir11, filters: [ *moving_avg, *pos, multiply: "${cir11mult}" ] } } - { phase_id: "${cir12phase}", input: "12", power: { name: "${cir12name} Power", id: cir12, filters: [ *moving_avg, *pos, multiply: "${cir12mult}" ] } } - { phase_id: "${cir13phase}", input: "13", power: { name: "${cir13name} Power", id: cir13, filters: [ *moving_avg, *pos, multiply: "${cir13mult}" ] } } - { phase_id: "${cir14phase}", input: "14", power: { name: "${cir14name} Power", id: cir14, filters: [ *moving_avg, *pos, multiply: "${cir14mult}" ] } } - { phase_id: "${cir15phase}", input: "15", power: { name: "${cir15name} Power", id: cir15, filters: [ *moving_avg, *pos, multiply: "${cir15mult}" ] } } - { phase_id: "${cir16phase}", input: "16", power: { name: "${cir16name} Power", id: cir16, filters: [ *moving_avg, *pos, multiply: "${cir16mult}" ] } } - platform: template name: "Total Power" lambda: return id(phase_a_power).state + id(phase_b_power).state; update_interval: 2.88s id: total_power device_class: power state_class: measurement unit_of_measurement: "W" - platform: total_daily_energy name: "Total Daily Energy" power_id: total_power accuracy_decimals: 0 - platform: template name: "Balance Power" lambda: !lambda |- return max(0.0f, id(total_power).state - id(cir01).state - id(cir02).state - id(cir03).state - id(cir04).state - id(cir05).state - id(cir06).state - id(cir07).state - id(cir08).state - id(cir09).state - id(cir10).state - id(cir11).state - id(cir12).state - id(cir13).state - id(cir14).state - id(cir15).state - id(cir16).state); update_interval: 2.88s id: balance_power device_class: power state_class: measurement unit_of_measurement: "W" - platform: total_daily_energy name: "Balance Daily Energy" power_id: balance_power accuracy_decimals: 0 - { power_id: cir01, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir01name} Daily Energy" } - { power_id: cir02, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir02name} Daily Energy" } - { power_id: cir03, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir03name} Daily Energy" } - { power_id: cir04, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir04name} Daily Energy" } - { power_id: cir05, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir05name} Daily Energy" } - { power_id: cir06, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir06name} Daily Energy" } - { power_id: cir07, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir07name} Daily Energy" } - { power_id: cir08, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir08name} Daily Energy" } - { power_id: cir09, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir09name} Daily Energy" } - { power_id: cir10, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir10name} Daily Energy" } - { power_id: cir11, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir11name} Daily Energy" } - { power_id: cir12, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir12name} Daily Energy" } - { power_id: cir13, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir13name} Daily Energy" } - { power_id: cir14, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir14name} Daily Energy" } - { power_id: cir15, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir15name} Daily Energy" } - { power_id: cir16, platform: total_daily_energy, accuracy_decimals: 0, name: "${cir16name} Daily Energy" }