ESPHome configuration basics

Sorry for such a noob question, but have just added my 1st ESPHome device and can’t figure out how to configure just about anything. It can’t be that hard - so the error must be mine, but I can’t see it…

Have added an Athom pre-flashed ESPHome Smart Switch. I gave it my SSID and wifi password OK - but there was nowhere in the web interface to set a username or access password, and nowhere to set a fixed IP address.

HA found the instance OK, but can not configure access credentials for the Smart Switch either. I have a block of addresses allocated for IOT devices, but this is still in DHCP territory where phones and PC aught to be.

Also, while the documentation here suggests I set a Friendly Name - I can’t find any way to do this. There is no option in either the device web interface, or in HA settings, and when I tried to copy the example into configuration.yaml …

esphome:
   name: "Smart Plug V2 a7f9f0"
   friendly_name: "Lounge Lamp"

It only generated an error on reboot which said…

" The esphome integration does not support configuration via YAML file. You may not notice any obvious issues with the integration, but any configuration settings defined in YAML are not actually applied.

To resolve this:

1. If you’ve not already done so, set up the integration.
2. Remove esphome: from your YAML configuration file.
3. Restart Home Assistant."

I have a bunch of these I bought all together - so it seems the only way I will be able to tell them apart is by keeping a written log of the Identification number the system automatically suffixes to its own name. (Not ideal)

There must be a better way. What am I missing?

That configuration goes into a separate yaml file in /config/esphome/

e.g. /config/esphome/lounge_lamp.yaml

Each device gets its own file. Another device file might be: /config/esphome/bedroom_lamp.yaml

These are the files that ESPHome will use to build the firmware of your device. They are what will show up as devices when you go to the ESPHome addon web page.

Thanks for the quick reply Tom :slight_smile:

That has got rid of the error message on reboot - but hasn’t actually done anything to rename the device. The file appears to be essentially being ignored by HA. I am assuming there must be a line in the standard configuration.yaml to include the new file (which makes me wonder why it couldn’t be in the configuration file directly like what can happen with automations.)

I attempted to add an include line in configuration.yaml

esphome: !include config/esphome/

But the Check Configuration tool in Developer options failed to even finish its test (is still stuck in a loop now) - so I figure this can’t be right…

Is there some documentation that actually explains how this is supposed to be done, rather than assuming noobs like me will know already?

Remove that.

ESPHome devices are added using the GUI. And they will be automatically discovered for you.

Read and follow this: Getting Started with ESPHome and Home Assistant — ESPHome

The process in a nutshell:

  1. Create the ESPHome device file.
  2. Use the ESPHome add-on to install the firmware on the device
  3. Wait for Home Assistant to discover the device and notify you.
  4. Add the device to Home Assistant by clicking the link in that notification.

Thanks again,

My thinking was that by selecting (and paying more for) a device that came pre-flashed with ESPHome I would bypass all the requirement to flash anything. (I had an expensive early experience of bricking a device I was trying to flash, and have avoided the process ever since…)

I have now installed the ESPHome addon - which has set a Friendly Name for the device (along with x hundred other things I have no idea what it was doing), but nothing in this new addon interface, or the “getting Started” guide you pointed to (thanks for that also) tells me anything about how to set a static IP address, or configure a username and password to access the smart plug’s web interface. It has also been “adopted” into HA as a switch (that’s logical), but I would like to include it as a “light”. All these things are trivially easy in the web interface of the Shelly devices I have been using everywhere else, but I can’t see how to do it with ESPHome. Like most things, I assume it is simple if you know how - and impossible if you don’t. Unfortunately with almost everything yaml, I am in the latter category.

Yeah I have no idea about how that works, I’ve only ever flashed my own devices. I’d say follow the vendors instructions.

Cheers Tom,

Found the conversion Helper half an hour ago - so already got that working. It is unfortunate however that the exact same outcome requires two completely different processes for two otherwise quite similar devices. It is neither logical nor intuitive that it should be so different, but I accept that that is just how it is :wink:

The manufacturer’s instructions are ridiculously brief, and I needed a magnifying glass to even read them. They say nothing about configuration at all I’m afraid.

Will keep searching for how to secure the web interface on the right IP. Thanks for your help.

ESPhome can be convoluted and daunting at first, but is fairly straightforward once you get the hang of it.

There’s a few components to break down:

  1. ESPhome firmware - this is the code flashed onto the device to tell it what to do.
  2. ESPhome integration - the integration used by HA to provide control and to receive data from an ESP device.
  3. ESPhome add-on - used to create/modify/flash ESPhome firmware.

By buying a pre flashed device, you did save some time figuring out the flashing process but at the expense of being able to customize the ESPhome firmware. These are prebuilt with ESPhome firmware to have the device be functional and allow them to be pulled into HA through the ESPhome integration. Easy peasy.

Something like a static IP (in my opinion) would be an edge use-case. Aside from network infrastructure in an enterprise network, there’s basically no reason to use a static IP and it’s recommended to do a DHCP reservation instead. I bring this up, because the prebuilt devices are geared towards the masses where 95% of folks are going to just use DHCP.

Doing something advanced, like setting a static IP, requires it to be configured in the firmware. For your case, that means building the firmware config file in the ESPhome add-on and reflashing the device.

I’ll be keen to know how to adopt devices into the ESPhome dashboard as well. I created a device through the Ready-Made Projects — ESPHome site which does not show up in the dashboard and therefore is still running old firmware. There is a link on that page for adopting which I’ll try later, but for other devices (like from Athom) this isn’t an option.

Esphome devices, especially pre-fashed ones, are easy to flash/program; just do an OTA using the add-on. with the recent updates, it is even faster to compile thanks to bradco’s updates.

Tom, I think you are jumping ahead of the line a bit.

Pcal- Not a noob question… I have purchased a few Athom devices with ESPHome already flashed. And I’ve flashed more than a few myself.

Find the IP of the Athom device. Your router may show the connected devices, or you can get an IP scanner. If you find the IP address, try opening it in your browser. The pre-flashed ESPHome has a web server that exposes a few things about the device.

BTW- Why do you want a static IP? I avoid static IPs for everything except for my servers- I have more than 100 devices on my network and managing 100 static IPs would be too much for my lazy a**. But if you really want to, here’s the docs.

Next, realize that ESPHome does not require Home Assistant to function, as the above exercise demonstrates. To integrate an ESPHome device you need to install the ESPHome Integration (which it appears you already have). But Home Assistant needs the device YAML file to integrate. To get that go to the device page on the Athom website and download the YAML file:

This file needs to be copied into config/esphome. How you get it there depends on how you installed Home Assistant. If you install the Samba Share add-on then you can open the config folder from the network section of File Explorer. You may also want to install the File Editor add-on. If you want to put in your WiFi credentials, edit the YAML file and follow the instructions in the WiFi docs. Otherwise you will use the WiFi manager to set up your WiFi credentials. Connect your phone to the Athom AP and the WiFi manager will ask for your WiFi credentials.

Once that file is in your config/esphome directory, restart Home Assistant to force discovery.

Now you have the ESPHome device integrated in Home Assistant.

It took longer to explain this than it will take to actually do it.

Hope this helps.

instead of using a static address, he might be better off with use_address

No, no, no…
This is used when changing the address of an existing ESPHome device. He hasn’t yet integrated the device into Home Assistant.

Switching an esphome device from DHCP (192.168.1.89) to static IP (192.168.1.213).

In the device yaml code, add the static IP:

wifi: ssid: !secret wifi_ssid
password: !secret wifi_password
manual_ip: static_ip: 192.168.1.213
gateway: 192.168.1.1
subnet: 255.255.255.0

use_address: 192.168.1.89

use_address is the OLD address for esphome to use when it uploads the new firmware. You will remove the use_address line after the first upload to the device then upload it again.

1 Like

as ssieb discussed in discord, use_address as it’s uses besides changing the IP. e.g I don’t see some devices in the dashboard and I will add a new device, configure my yaml for it and use use_address to push the code.