A silly simple question about ESPHome (specifically M5Stack ATOM Echo) firmware?

I have tried to find a concrete answer on this, but have failed so far. Lots of partial answers, but nothing that I’m confident fully explains. So please forgive this silly simple question!

I have an M5Stack ATOM Echo, which I got working back in November, and has worked /fairly/ well ever since. Including with wake-word functionality “OK Nabu!”. It doesn’t always activate on that wake word, but mostly it does.

I did the install by carefully following the instructions at the following URL :

Part of this process was re-flashing the tiny atom echo device via USB.

Since that time, lots of improvements have happened on the main HA software. What I am wondering is… have there also been firmware upgrades for the Atom Echo in that intervening time? Should I somehow have been upgrading this too?

When I check it in the devices it says : “Firmware: 2023.10.6 (Nov 12 2023, 18:39:54)”

My first question is, very simply, is this the latest firmware for the Atom Echo?
My second question (if “yes” to the first) is how do I upgrade it to the latest?

Thank you!
Alex.

1 Like

There have been updates since then, which should affect the ATOM Echo. Do you have the ESPHome add-on installed? If so, it should show that an update is available in its web UI.

I have the exact same question. I setup the Echo according to the same instructions (web installer) pretty much as soon as it came out.

But it hasn’t updated in months. The firmware version is still 2023.10.1, and the created update firmware entity just says “Unknown”.

It’s a little hard to believe that nothing has been updated in 4 months.

Btw. I only see the device in the ESPHome integration, but not in the ESPHome addon.

So:

  1. is there a newer firmware version?
  2. how to update it? Do I need to manually flash it through the ESPHome addon, and the yaml file found here https://github.com/esphome/firmware/blob/735ea09e64897b8248baeb2501e524c29e56b3c7/voice-assistant/m5stack-atom-echo.yaml, instead of doing it through the web installer, as I did initially?

The main reason I’m looking for an update is that the wake word seems to have some issues. It does detect it, but after the device sits idle for a while, it seems like it stops listening. I have to toggle the “Use wake word” switch off and on again, in order to get it to start listening again. I was hoping a firmware update would fix this

Has anyone seen it update yet, or even where the repo is?
I too am finding the thing seems to just go to sleep after a while…

So actually there is an update for sleeping m5stack atom echoes,
the sleeping was caused by some full audio buffer due to a software bug.

what I did is:

  • using the latest version of ESPHOME (v 2024.2.2)
  • sudo esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash
  • reflash the atom echo with the following code
esphome:
  name: echo-voice-1
  friendly_name: Echo Voice 1
  name_add_mac_suffix: true
  project:
    name: m5stack.atom-echo-voice-assistant
    version: "1.0"
  min_version: 2024.2.0

esp32:
  board: m5stack-atom
  framework:
    type: esp-idf

logger:
api:
ota:

dashboard_import:
  package_import_url: github://esphome/firmware/voice-assistant/m5stack-atom-echo.yaml@main

wifi:
  on_connect:
    - delay: 5s  # Gives time for improv results to be transmitted
    - ble.disable:
  on_disconnect:
    - ble.enable:
  ssid: myssid
  password: mywifipw

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.1.30
    gateway: 192.168.1.1
    subnet: 255.255.255.0

improv_serial:

esp32_improv:
  authorizer: none

button:
  - platform: factory_reset
    id: factory_reset_btn
    name: Factory reset

i2s_audio:
  i2s_lrclk_pin: GPIO33
  i2s_bclk_pin: GPIO19

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

speaker:
  - platform: i2s_audio
    id: echo_speaker
    i2s_dout_pin: GPIO22
    dac_type: external
    mode: mono

voice_assistant:
  id: va
  microphone: echo_microphone
  speaker: echo_speaker
  noise_suppression_level: 2
  auto_gain: 31dBFS
  volume_multiplier: 2.0
  vad_threshold: 3
  on_listening:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        effect: "Slow Pulse"
  on_stt_vad_end:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        effect: "Fast Pulse"
  on_tts_start:
    - light.turn_on:
        id: led
        blue: 100%
        red: 0%
        green: 0%
        brightness: 100%
        effect: none
  on_tts_end:
  - homeassistant.service:
      service: media_player.play_media
      data:
        entity_id: media_player.wohnzimmer #add your media player here
        media_content_id: !lambda 'return x;'
        media_content_type: music
        announce: "true"
  on_end:
    - delay: 100ms
    - wait_until:
        not:
          speaker.is_playing:
    - script.execute: reset_led
  on_error:
    - light.turn_on:
        id: led
        red: 100%
        green: 0%
        blue: 0%
        brightness: 100%
        effect: none
    - delay: 1s
    - script.execute: reset_led
  on_client_connected:
    - if:
        condition:
          switch.is_on: use_wake_word
        then:
          - voice_assistant.start_continuous:
          - script.execute: reset_led
  on_client_disconnected:
    - if:
        condition:
          switch.is_on: use_wake_word
        then:
          - voice_assistant.stop:
          - light.turn_off: led

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO39
      inverted: true
    name: Button
    disabled_by_default: true
    entity_category: diagnostic
    id: echo_button
    on_multi_click:
      - timing:
          - ON for at least 250ms
          - OFF for at least 50ms
        then:
          - if:
              condition:
                switch.is_off: use_wake_word
              then:
                - if:
                    condition: voice_assistant.is_running
                    then:
                      - voice_assistant.stop:
                      - script.execute: reset_led
                    else:
                      - voice_assistant.start:
              else:
                - voice_assistant.stop
                - delay: 1s
                - script.execute: reset_led
                - script.wait: reset_led
                - voice_assistant.start_continuous:
      - timing:
          - ON for at least 10s
        then:
          - button.press: factory_reset_btn

light:
  - platform: esp32_rmt_led_strip
    id: led
    name: None
    disabled_by_default: true
    entity_category: config
    pin: GPIO27
    default_transition_length: 0s
    chipset: SK6812
    num_leds: 1
    rgb_order: grb
    rmt_channel: 0
    effects:
      - pulse:
          name: "Slow Pulse"
          transition_length: 250ms
          update_interval: 250ms
          min_brightness: 50%
          max_brightness: 100%
      - pulse:
          name: "Fast Pulse"
          transition_length: 100ms
          update_interval: 100ms
          min_brightness: 50%
          max_brightness: 100%

script:
  - id: reset_led
    then:
      - if:
          condition:
            - switch.is_on: use_wake_word
            - switch.is_on: use_listen_light
          then:
            - light.turn_on:
                id: led
                red: 100%
                green: 89%
                blue: 71%
                brightness: 60%
                effect: none
          else:
            - light.turn_off: led

switch:
  - platform: template
    name: Use wake word
    id: use_wake_word
    optimistic: true
    restore_mode: RESTORE_DEFAULT_ON
    entity_category: config
    on_turn_on:
      - lambda: id(va).set_use_wake_word(true);
      - if:
          condition:
            not:
              - voice_assistant.is_running
          then:
            - voice_assistant.start_continuous
      - script.execute: reset_led
    on_turn_off:
      - voice_assistant.stop
      - lambda: id(va).set_use_wake_word(false);
      - script.execute: reset_led
  - platform: template
    name: Use listen light
    id: use_listen_light
    optimistic: true
    restore_mode: RESTORE_DEFAULT_ON
    entity_category: config
    on_turn_on:
      - script.execute: reset_led
    on_turn_off:
      - script.execute: reset_led

external_components:
  - source: github://pr#5230
    components:
      - esp_adf
    refresh: 0s

esp_adf:
2 Likes

Had the same issue, firmware showed 2023.12.5.

What worked for me was to first compile again, not just upload:

esphome compile ./echo.yaml
esphome upload ./echo.yaml

I now see the firmware version 2024.3.2 in Home Assistant.

I have my atoms for a few weeks now. ESPHome is being updated when there is an update (today, in fact! version 2024.5.2)

For the atom code, I am using this:

substitutions:
  name: m5stack-atom-echo-123456
  friendly_name: M5Stack Atom Echo 1
  external_media_player_id: media_player.move_2_1
packages:
  m5stack.atom-echo-voice-assistant: github://esphome/firmware/voice-assistant/m5stack-atom-echo.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: /cLhNEputyoursecretkeyheresQfA0aXM=

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

voice_assistant:
  id: va
  on_tts_end:
    - homeassistant.service:
        service: media_player.play_media
        data:
          entity_id: ${external_media_player_id}
          media_content_id: !lambda 'return x;'
          media_content_type: music
          announce: "true"

The media_player addition can be done without copying the complete ESP config, but I haven’t found a similar way to disable the internal speaker…

I tried to keep the code as clean as possible, with the only adjustments in the substitution section. I have not found a way to put the api key in the secrets file. And if you want more then 1 media_player, you need to repeat the code: with a media_player group the announce function doesn’t work well (turns off the music, not back on again!) I believe that’s a media_player group thing, not an Atom Echo issue.

When a new version of ESPhome comes out, the Atom wants to update as well, and that means a recompile. But it is very straightforward.

1 Like