Adoptable ESPHome yaml?

I have 8 Sonoff S31 plugs used for more than a year around the house and they are great.
To flash those I created a the YAML file in ESPHome Addon, with API key, secrets and include common config for all S31:

  name: sonoff-s31-01
  friendly_name: Sonoff S31 01
  restore_mode: ALWAYS_ON

<<: !include common/sonoff-s31.yaml

# Enable Home Assistant API
    key: "<key>="

  password: "<password>"

  ssid: !secret wifi_ssid
  password: !secret wifi_password

I got 8 more plugs and want to flash them with ESPHome, but I don’t want to create and store 8 more yaml files on my HA. But rather to be able to adopt them in HA later, when I need them.

Is there a way to do that?

You will of course need a seperate ESPHome development environment to prepare the devices.

And a GitHub page to host the yaml.

1 Like

Another option is to create a ‘base’ yaml, and include it in each device.

<<: !include esp-base.yaml

In that base I put things like my wifi credentials, ota, webserver, logger, time etc. All generic info I use on all my devices. When included in another yaml, all data from the base will be used in the device.

Only downside; I have one base device in my esphome dashboard that remains offline :thinking:
Ofc I could move it to some other folder, but I like it like this, because I can edit it from the dashboard :wink:

You can create a subfolder under config/esphome and move your esp-base.yaml there and it will not be visible in the ESPHome extension any more. If you check the code I posted originally - it includes a common config for all Sonoff S31 devices: <<: !include common/sonoff-s31.yaml

Regardless - it’s not what I was asking about. Including data shared by all devices is no brainer. It’s more tricky to flash a new device without having to store in the extension its yaml with api key and all specifics unique to each device

Not the most comprehensive documentation, but it worked. Thank you!