Athom, Esphome and flashing

The Athom wall switch integrates with Home Assistant like a champion using Esphome. However, this leaves me right where I was without Esphome. Athom’s proprietary firmware, not open source, so I cannot reflash the wall switch with a modified version of Athom’s firmware.

I thought I would be able to download the Athom yaml file from github, modify it, and flash it. I cannot. After a bunch of yellow warnings, the install fails. The Home Assistant Esphome interface won’t even install the yaml file left after integration of the Athom switch with Home Assistant.

I read about using web server OTA and the firmware.bin file, but I can’t locate a single “.bin” file on the HA Blue or my windows desktop. I would like to eliminate web server OTA altogether and give the little 8285 a break; it worked great for integration when you can’t hard code wifi information, however.

Did you stay on one feet while you were trying to flash it? :foot:

Other than that there is not much no information (yaml and logs for example) provided which could help us helping you. :man_shrugging:

You might want to take some minutes reading this very useful post :point_down:

1 Like

Struggling with this question I must admit. Athom stuff isn’t closed, it’s ESPhome flashed if that’s what you ordered (or tasmota). The yaml is all available both on their product pages and the GitHub and in addition they are very helpful with tech support. What product are you specifically having issues with?

You can compile the bin if you take the manual install option and it prompts you to download it. You can then use this on the OTA and that works just fine. Can only assume you have an error in the yaml, post it up and we can look.

1 Like

“Did you stay on one feet stand on one foot, while you were trying to flash it?” NO.

Here are the yaml files:

Left over after integration with HA in the Esphome Addon that fails:

substitutions:
  name: kitchen-wall

esphome:
  name: ${name}
  name_add_mac_suffix: false

packages:
  athom.sw04: github://athom-tech/athom-configs/athom-sw04.yaml

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

I would like to upload a modified version of Athom’s yaml file below but fails:

substitutions:
  name: "kitchen-wall"
  friendly_name: "Kitchen Wall"
  light1_restore_mode: RESTORE_DEFAULT_OFF
  light2_restore_mode: RESTORE_DEFAULT_OFF
  light3_restore_mode: RESTORE_DEFAULT_OFF
  light4_restore_mode: RESTORE_DEFAULT_OFF

esphome:
  name: "${name}"

esp8266:
  board: esp8285
  restore_from_flash: true

preferences:
  flash_write_interval: 1min

api:

ota:

logger:
  baud_rate: 0

mdns:
  disabled: false

web_server:
  port: 80

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap: {} # This spawns an AP with the device name and mac address with no password.

captive_portal:

binary_sensor:
  - platform: status
    name: "${friendly_name} Status"

  # Touch Buttons
  - platform: gpio
    pin:
      inverted: true
      number: GPIO12
    name: "${friendly_name} Button 1"
    disabled_by_default: true
    on_multi_click:
      - timing:
          - ON for at most 0.5s
          - OFF for at least 0.2s
        then:
          - light.toggle: light1
      - timing:
          - ON for at least 4s
        then:
          - button.press: Reset
          
  - platform: gpio
    pin:
      inverted: true
      number: GPIO3
    name: "${friendly_name} Button 2"
    disabled_by_default: true
    on_click:
      max_length: 0.5s
      then:
        - light.toggle: light2
  - platform: gpio
    pin:
      inverted: true
      number: GPIO5
    name: "${friendly_name} Button 3"
    disabled_by_default: true
    on_click:
      max_length: 0.5s
      then:
        - light.toggle: light3
  - platform: gpio
    pin:
      inverted: true
      number: GPIO16
    name: "${friendly_name} Button 4"
    disabled_by_default: true
    on_click:
      max_length: 0.5s
      then:
        - light.toggle: light4

sensor:
  - platform: uptime
    name: "${friendly_name} Uptime"

button:
  - platform: factory_reset
    name: Restart with Factory Default Settings
    id: Reset

output:
  # Relays
  - platform: gpio
    pin: GPIO13
    id: relay1
  - platform: gpio
    pin: GPIO4
    id: relay2
  - platform: gpio
    pin: GPIO15
    id: relay3
  - platform: gpio
    pin: GPIO14
    id: relay4

light:
  - platform: status_led
    name: "${friendly_name} Status LED"
    disabled_by_default: true
    pin:
      number: GPIO0
      inverted: true

  # Relays
  - platform: binary
    name: "${friendly_name} Light 1"
    id: light1
    output: relay1
    restore_mode: ${light1_restore_mode}
  - platform: binary
    name: "${friendly_name} Light 2"
    id: light2
    output: relay2
    restore_mode: ${light2_restore_mode}
  - platform: binary
    name: "${friendly_name} Light 3"
    id: light3
    output: relay3
    restore_mode: ${light3_restore_mode}
  - platform: binary
    name: "${friendly_name} Light 4"
    id: light4
    output: relay4
    restore_mode: ${light4_restore_mode}

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "${friendly_name} IP Address"
      disabled_by_default: true
     
time:
  - platform: sntp
    id: my_time

I tried to update the wall switch with an Esphome firmware update just minutes ago, but it fails. All return the following error after what must be four or five pages of yellow warnings during the install.

collect2: error: ld returned 1 exit status
*** [/data/kitchen-wall/.pioenvs/kitchen-wall/firmware.elf] Error 1
========================= [FAILED] Took 55.89 seconds =========================

Please post your entire log.

Hello. From your ESPHome dashboard create a profile for your switch. Then create your desired yaml file and then in the corner of your edit screen you install. You will select the manual download and then legacy file, and it will compile and download a .bin for you. Then go to your Athom device web site and select the OTA box. It will ask you for a file to upload. Use the .bin you have created and previously (in the last step) downloaded

If this fails at any point, can you be really clear what the problem is. I have two Athom (preflashed) home plugs in front of me. All working perfectly (it took me a while to work out how to do it)

Or select ‘wirelessly’. Simpler.

The wireless doesn’t work, but now I see the manual download route (I had no idea that was what people were writing about). I’m trying that, and I’ll let the post know the outcome. If it fails, I’ll post all the logs. The above yaml files and the three same errors were from trying the “Wirelessly” selection.

Thanks everyone. I’ve been working on this for hours, but what else do I have to do that’s so much fun with the right amount of frustration. :grinning:

I seem to remember that I couldn’t do that on the first yaml. I think the problem was that it is before the profile is already set up in ESPHome. After that first flash they appeared in the dashboard. However, wireless if you can!

I tried a manual, modern and legacy compilation of the yaml file left over after integrating the Athom switch, but this too failed just like all the “Wirelessly” attempts. How can I have a compilation failure on a device already installed, and you are uploading the exact same yaml file? I can’t upload the log as it is over 149,000 characters, and the post is limited to 32,000.

I have a second wall switch i’ll try. I’ll integrate it and see if I can install my own yaml file.

Use pastebin for the log.

Also, what version of esphome (it is shown at the bottom of the ui).

Specifically, how does it fail?

This post may give you some ideas.

1 Like

Hello this does not match my experience. Consequently I don’t understand.

I first had to create a brand new yaml file. I downloaded the template (there is a reference website where you can copy it from). At this point the Athom device is not integrated. I then compiled and created the bin file

Have you done that? Did it work? Can you see a new bin file? Were there errors. Screenshot of compiling if it failed. Let’s see the red bits

How are you uploading? Did you find the web site for the device. Was the ip address for it clear? Did the OTA work. So what I mean by that is; did you use the web site interface rather than the wireless upload.

How do you know it is the exact yaml ? I thought you couldn’t access it? I was never able to access the original yaml; so I am not clear how you are?

More and clearer information please. I have my Athom devices in front of me and ready to test.

Please, no screenshots of text.

1 Like

I did a factory reset of the Athom wall switch with the switch’s web server, and then adopted the Athom a second time in HA, Esphome.

I had the procedure or protocol wrong. First, adopt the Athom device. Then modify the yaml file you want to upload, download, or “install” using Esphome jargon, to the Athom device. DO NOT install the default yaml file generated by the adoption. Once you have the personalized and modified Athom yaml file you want, or the one you want to start with, then do the first OTA install from HA, Esphome.

Athom is going to work for me with the software flexibility. Out of all the hardware on Aliexpress, I think Athom is a winner for HA and Esphome.

All is well, but I’ve been drinking: :beer: :cocktail:

2 Likes

As a site note the command line version of esphome might superior/easier in this case.

All I do to get a device “owned” is to create my yaml of choice and then directly OTA (wireless) it over the “old” device.

esphome run newname.yaml --device athom-sw04.local