Cannot install or reinstall ESPHome with Atom Echo on HAOS

I’ve now spent most of the day into the evening (at least 7 hours) trying to install an Atom Echo on HAOS (latest version). The device appeared to install this morning but with a solid red light, no response to button presses and no media player entity in Home Assistant.

After many attempts to fix things and recurring errors of all kinds, I uninstalled the ESPHome add-on and (from File Editor) attempted to manually delete all the files left behind in the ESPHome folders, but eventually gave up because of apparently dozens of subfolders. Shouldn’t these be deleted automatically when the add-on is uninstalled?

I then reconnected the device to the USB port on my Windows PC

From page $13 voice remote for Home Assistant - Home Assistant

Clicked “Connect”

Clicked “Install Voice Assistant” and waited until “Installation complete” appeared.

Clicked “Next” and then entered Wi-Fi credentials when prompted.

Clicked “Next” again and got the prompt “Open page in your Home Assistant? You’ve been linked to the page that will start setting up a new integration.”

On “Do you want to set up ESPHome?”, clicked OK (I had not reinstalled the integration at this point because the page didn’t ask me to.)

I then saw the dreaded prompt “Please enter connection settings of your ESPHome node”. Surely this node should not exist at this point!

I entered the details
Host (My host’s IP address - double checked. Static IP address reserved in my router. Putting http:// before this made no difference)
Port 6053

This gave the error “Can’t connect to ESP. Please make sure your YAML file contains an ‘api:’ line.” - the same error I’d seen earlier that had prompted me to uninstall and reinstall. On the reinstall attempt I was not given an encryption key, which had happened on each previous attempt.

Can anyone tell me why this is happening when I’m trying to install ESPHome and the device again from scratch, and how I can get round it?

Thanks.

Good question. First thing the people in this forum who could help you need logs or a crystal ball :crystal_ball:

How to help us help you - or How to ask a good question

:point_right: :one::three: Share the logs

The host in this case is the esphome node - right? Like described in the docs under the headline: “Connecting your device to Home Assistant” :point_down:

Thanks - yes, ESPHome is on the same server as my Home Assistant. I finally resolved that issue and have to admit that it was my mistake: the static IP address in my config file was for the Atom Echo and not the server… a stupid mistake but an easy one to make as the default comment in the file says “the address of the ESP” which implies the ESP (wireless) device and not the server. Once I entered the server address, I could finally install the Atom without errors.

I now need to figure out why, although I can switch its red light on and off from Home Assistant, nothing at all happens (not even its expected blue/green light) when I press the button on the Atom. (The references to the actions including the light colours are there in the YAML config file.)

1 Like

I’m even more confused now. Attempting to fix the last error above, I have attempted a couple of times to update my Echo device. At the end of this process, I see the error below.

Successfully created esp32 image.
esp32_create_combined_bin(["/data/atom-echo-277/.pioenvs/atom-echo-277/firmware.bin"], ["/data/atom-echo-277/.pioenvs/atom-echo-277/firmware.elf"])
Wrote 0x13e040 bytes to file /data/atom-echo-277/.pioenvs/atom-echo-277/firmware-factory.bin, ready to flash to offset 0x0
========================= [SUCCESS] Took 58.38 seconds =========================

********************************************************************************
We found 1.03GB of unnecessary PlatformIO system data (temporary files, unnecessary packages, etc.).
Use `pio system prune --dry-run` to list them or `pio system prune` to save disk space.
INFO Successfully compiled program.
INFO Connecting to 192.168.1.37
ERROR Connecting to 192.168.1.37:3232 failed: [Errno 111] Connection refused

.37 is the address of my HAOS server, not the Atom Echo which is on .38. If connecting to ESPHome works only when I set the static IP address above for my server, where do I tell HA/ESPHome the address of the Atom Echo?

Could you share the yaml you are trying to compile/upload?

In that yaml I requested :stuck_out_tongue_winking_eye:

1 Like

Thanks. Here is the YAML for the Atom Echo device.

esphome:
  name: atom-echo-277
  friendly_name: Atom Echo

i2s_audio:
  i2s_lrclk_pin: GPIO33
  i2s_bclk_pin: GPIO19

esp32:
  board: m5stack-atom
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "wsEhCQf9cN+jhxj6Arq1+Fift4nASuWTO2GDGRBJcO8="

ota:
  password: "eb9917fd7d7aa84f493303b61d03b713"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    # Set this to the IP of the ESP (device?)
    static_ip: 192.168.1.38
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.1.1
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Atom-Echo-277 Fallback Hotspot"
    password: "3NXyGBA2ChXQ"

improv_serial:
    
microphone:
  - platform: i2s_audio
    id: atom_echo_microphone
    i2s_din_pin: GPIO23
    adc_type: external
    pdm: true

voice_assistant:
  microphone: atom_echo_microphone
  on_start:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        effect: none
  on_tts_start:
    - light.turn_on:
        id: led
        blue: 0%
        red: 0%
        green: 100%
        effect: none
  on_tts_end:
  # - media_player.play_media: !lambda return x;
    - light.turn_on:
        id: led
        blue: 0%
        red: 0%
        green: 100%
        effect: pulse
  on_end:
    - delay: 1s
    - wait_until:
        not:
          media_player.is_playing: media_out
    - light.turn_off: led
  on_error:
    - light.turn_on:
        id: led
        blue: 0%
        red: 100%
        green: 0%
        effect: none
    - delay: 1s
    - light.turn_off: led

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
    name: Button
    id: echo_button
    # Note: the next two triggers were missing from the initial config - explains why nothing happened when pressing button!
    on_press:
      - voice_assistant.start:
    on_release:
      - voice_assistant.stop:
    on_multi_click:
      - timing:
          - ON FOR AT MOST 350ms
          - OFF FOR AT LEAST 10ms
        then:
          - media_player.toggle: media_out
      - timing:
          - ON FOR AT LEAST 350ms
        then:
          - voice_assistant.start:
      - timing:
          - ON FOR AT LEAST 350ms
          - OFF FOR AT LEAST 10ms
        then:
          - voice_assistant.stop:

media_player:
  - platform: i2s_audio
    id: media_out
    name: None
    dac_type: external
    i2s_dout_pin: GPIO22
    mode: mono

light:
  - platform: esp32_rmt_led_strip
    id: led
    name: None
    pin: GPIO27
    default_transition_length: 0s
    chipset: SK6812
    num_leds: 1
    rgb_order: grb
    rmt_channel: 0
    effects:
      - pulse:
          transition_length: 250ms
          update_interval: 250ms

After a reinstall on the device it now shows as persistently offline, regardless of the static IP address in the above (and reloading YAML after changing it). I’m baffled by the fact that there are 3 rather than 2 IP addresses relating to the installation (ESP_049B2 on .19, homeassistant on .37 and m5-stack-atom-echo-82be60 on .38), especially as all have Mac addresses. Is the ESP installation meant to have its own IP address even when it’s just a piece of software on .37? Isn’t a Mac address just for hardware? The latter two IP addresses are both reserved for the devices on my router.

After yet another reinstallation, this time using “PREPARE FOR FIRST USE”, setup failed right at the end with “socket operation failed” and then “invalid encryption key”, despite the fact that the key I was given during this installation matches the one in my YAML file. I can see this was logged as an issue on GitHub and it seems the developers flagged it as fixed: not for me!

INFO Uploading /data/esphome-web-82be60/.pioenvs/esphome-web-82be60/firmware.bin (904704 bytes)
Uploading: [============================================================] 100% Done...

INFO Waiting for result...
INFO OTA successful
INFO Successfully uploaded program.
INFO Starting log output from esphome-web-82be60.local using esphome API
INFO Successfully connected to esphome-web-82be60.local
[16:17:10][I][app:102]: ESPHome version 2023.7.0 compiled on Jul 30 2023, 16:16:22
[16:17:10][C][wifi:543]: WiFi:
[16:17:10][C][wifi:379]:   Local MAC: 64:B7:08:82:BE:60
[16:17:10][C][wifi:380]:   SSID: [redacted]
[16:17:10][C][wifi:381]:   IP Address: 192.168.1.38
[16:17:10][C][wifi:383]:   BSSID: [redacted]
[16:17:10][C][wifi:384]:   Hostname: 'esphome-web-82be60'
[16:17:10][C][wifi:386]:   Signal strength: -48 dB ▂▄▆█
[16:17:10][C][wifi:390]:   Channel: 9
[16:17:10][C][wifi:391]:   Subnet: 255.255.255.0
[16:17:10][C][wifi:392]:   Gateway: 192.168.1.1
[16:17:10][C][wifi:393]:   DNS1: 192.168.1.1
[16:17:10][C][wifi:394]:   DNS2: 0.0.0.0
[16:17:10][C][logger:301]: Logger:
[16:17:10][C][logger:302]:   Level: DEBUG
[16:17:10][C][logger:303]:   Log Baud Rate: 115200
[16:17:10][C][logger:305]:   Hardware UART: UART0
[16:17:10][C][captive_portal:088]: Captive Portal:
[16:17:10][C][mdns:112]: mDNS:
[16:17:10][C][mdns:113]:   Hostname: esphome-web-82be60
[16:17:10][C][ota:093]: Over-The-Air Updates:
[16:17:10][C][ota:094]:   Address: esphome-web-82be60.local:3232
[16:17:10][C][api:138]: API Server:
[16:17:10][C][api:139]:   Address: esphome-web-82be60.local:6053
[16:17:10][C][api:141]:   Using noise encryption: YES
[16:17:33][D][api:102]: Accepted 192.168.1.37
[16:17:33][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:17:33][D][api:102]: Accepted 192.168.1.37
[16:17:33][W][api.connection:083]: 192.168.1.37: Socket operation failed: BAD_INDICATOR errno=11
[16:18:34][D][api:102]: Accepted 192.168.1.37
[16:18:34][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:19:34][D][api:102]: Accepted 192.168.1.37
[16:19:34][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:20:34][D][api:102]: Accepted 192.168.1.37
[16:20:34][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:21:34][D][api:102]: Accepted 192.168.1.37
[16:21:34][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:21:59][I][ota:113]: Boot seems successful, resetting boot loop counter.
[16:21:59][D][esp32.preferences:114]: Saving 1 preferences to flash...
[16:21:59][D][esp32.preferences:143]: Saving 1 preferences to flash: 0 cached, 1 written, 0 failed
[16:22:34][D][api:102]: Accepted 192.168.1.37
[16:22:34][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:23:34][D][api:102]: Accepted 192.168.1.37
[16:23:35][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:24:35][D][api:102]: Accepted 192.168.1.37
[16:24:35][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:25:35][D][api:102]: Accepted 192.168.1.37
[16:25:35][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:26:35][D][api:102]: Accepted 192.168.1.37
[16:26:35][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:27:35][D][api:102]: Accepted 192.168.1.37
[16:27:35][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11
[16:28:36][D][api:102]: Accepted 192.168.1.37
[16:28:36][W][api.connection:083]: 192.168.1.37: Socket operation failed: HANDSHAKESTATE_READ_FAILED errno=11

I even went back and deleted the ESPHome add-on and started from scratch. I got a new encryption key and again checked the YAML file, but with the same result. It seems that this device is strictly for experts and mine may well end up in the bin for the sake of my mental health.

Can you try removing the device from the integration and re-adding it?

I already have. I even removed the integration and re-added that but still got the encryption key error. I must have now tried to install the thing 15 times over a period of days and spent about 20 hours on it. Initially it seemed to install but, although I could switch its red light on and off from HA, I couldn’t get it to trigger any events by pressing its button (the light didn’t illuminate when I did that). I’ve decided that enough is enough and it’s been discarded. Thanks for trying to help.

1 Like

For some reason, the entity light.m5stack_atom_echo_xxx is disabled after configuring the ESPHome node. If you go to the Atom Echo device in Home Assistant, you will likely see “1 entity not shown” somewhere. Click on this message, and you will see the disabled entity. After enabling this entity I could use my Atom Echo device to trigger events.