First Time ESPHome - Emporia Vue - Invalid encryption key

I was able to flash the device and then update it with the specific YAML config for the power monitor. It shows up in HA, but only has the firmware update entity.

image

I followed both this video and this github.

When I updated the config from ESPHome in HA, I do get this warning…

========================= [SUCCESS] Took 10.00 seconds =========================
INFO Successfully compiled program.
INFO Resolving IP address of panel-monitor-01.local
INFO → 10.20.1.17
INFO Uploading /data/panel-monitor-01/.pioenvs/panel-monitor-01/firmware.bin (860800 bytes)
ERROR Error auth result: Error: Authentication invalid. Is the password correct?

And when I look at the logs of the device I get this warning…

WARNING panel-monitor-01.local: Connection error occurred:

Here is part of the config what shows the api section. There is more to the config, I can post if needed. The API key here matches what shows up in ESPHome when I say “show api key”. Is there something else I should be doing?

esphome:
  name: panel-monitor-01
  friendly_name: Panel Monitor 01
  build_path: .esphome/build/panel-monitor-01
  platformio_options: {}
  includes: []
  libraries: []
  name_add_mac_suffix: false
  min_version: 2023.2.4
esp32:
  board: esp32dev
  framework:
    version: 4.4.2
    sdkconfig_options: {}
    advanced:
      ignore_efuse_mac_crc: false
    source: ~3.40402.0
    platform_version: platformio/espressif32 @ 5.2.0
    type: esp-idf
  variant: ESP32
preferences:
  flash_write_interval: 48h
external_components:
- source:
    url: https://github.com/emporia-vue-local/esphome.git
    ref: dev
    type: git
  components:
  - emporia_vue
  refresh: 1d
api:
  encryption:
    key: NWWif+f+UgDzhaaBO0ilIVPLTE47BHwvTDmx8NJqfuc=

  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: "<secure_password>"

# Enable logging
logger:

wifi:
  # Wifi credentials are stored securely by new device wizard.
  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

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

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 <in-use calibration value> * <accurate voltage> / <reporting voltage>
        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 <in-use calibration value> * <accurate voltage> / <reporting voltage>
        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
          device_class: 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
          device_class: 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: phase_a, input:  "1", power: { name:  "Circuit 1 Power", id:  cir1, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "2", power: { name:  "Circuit 2 Power", id:  cir2, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input:  "3", power: { name:  "Circuit 3 Power", id:  cir3, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input:  "4", power: { name:  "Circuit 4 Power", id:  cir4, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input:  "5", power: { name:  "Circuit 5 Power", id:  cir5, filters: [ *moving_avg, *pos, multiply: 2 ] } }
      - { phase_id: phase_a, input:  "6", power: { name:  "Circuit 6 Power", id:  cir6, filters: [ *moving_avg, *pos, multiply: 2 ] } }
      - { phase_id: phase_a, input:  "7", power: { name:  "Circuit 7 Power", id:  cir7, filters: [ *moving_avg, *pos, multiply: 2 ] } }
      - { phase_id: phase_b, input:  "8", power: { name:  "Circuit 8 Power", id:  cir8, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input:  "9", power: { name:  "Circuit 9 Power", id:  cir9, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input: "10", power: { name: "Circuit 10 Power", id: cir10, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "11", power: { name: "Circuit 11 Power", id: cir11, filters: [ *moving_avg, *pos, multiply: 2 ] } }
      - { phase_id: phase_a, input: "12", power: { name: "Circuit 12 Power", id: cir12, filters: [ *moving_avg, *pos, multiply: 2 ] } }
      - { phase_id: phase_a, input: "13", power: { name: "Circuit 13 Power", id: cir13, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "14", power: { name: "Circuit 14 Power", id: cir14, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_b, input: "15", power: { name: "Circuit 15 Power", id: cir15, filters: [ *moving_avg, *pos ] } }
      - { phase_id: phase_a, input: "16", power: { name: "Circuit 16 Power", id: cir16, filters: [ *moving_avg, *pos ] } }
  - platform: template
    name: "Total Power"
    lambda: return id(phase_a_power).state + id(phase_b_power).state;
    update_interval: 1s
    id: total_power
    unit_of_measurement: "W"
  - platform: total_daily_energy
    name: "Total Daily Energy"
    power_id: total_power
    accuracy_decimals: 0
  - { 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" }

The device shows up as ONLINE in ESPHome.

image

It is behaving as expected. You didn’t add any sensor to your YAML, so nothing to read and report. Follow the guide again and use the example yaml on the github page. At this point you should be able to add the sensors and flash OTA, no need to flash manually again.

Thank you for the reply. I did put the sensors in, I just didn’t add them to the post as I thought the issues was related to the api key. I have added the full yaml to the above post. Can you take another look?

I also get this when trying configure the device.

image

I see. I think the encryption key is the problem. Remove the encryption key and try again. If for some reason you can not remember the encryption key you used at the initial compilation, you may have to manually flash again, this time removing the encryption keys. I have gotten into trouble on a few occasions that I have learnt to leave out the encryption key on ESPHOME.

You mean “reflash” it without an encryption key?

Is that different from doing the install over again from ESPHome in HA?

I updated it with this and just installed again from HA, no difference, same error.

# Enable Home Assistant API
api:

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

What this usually mean is that your encryption key does not match. So, your only option now is to pull it apart and flash it again using the USB, but this time ensure that the encryption key is empty. If you are familiar with ESPHOME, you can simply download the binary using the ESPHOME dashboard and use tasmotizer or esp flasher to load the binary. That is what I did as I wasn’t sure how to use esptool to flash the “yaml” according to the GitHub guide.

Yes, I can try that later today when I get home from work. I’ll let you know. Thank you.

Ok, that worked. Thank you.

Last question, (I hope). Is it normal behavior that I have to reinstall the yaml in HA when it is power cycled in order to get it to reconnect?

Nope. Now you shouldn’t have to do that. When you power cycle, it should automatically reconnect.

It is reconnecting now. Not sure why it didn’t stick the first couple times but now I am good.