The configuration assigns a name and friendly name for the device.
It sets the ESP8266 board type (e.g., nodemcuv2
, d1_mini
, etc.).
esphome:
name: ${name}
friendly_name: ${friendly_name}
esp8266:
board: ${board}
The device is configured to connect to a WiFi network using the provided credentials. In case of a failure, a fallback access point is created.
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: ${friendly_name} Fallback AP
password: !secret project_name_ap_password
- ssid: Your WiFi network's SSID.
- password: The password for your WiFi network.
- Fallback AP: If the device can't connect to the WiFi network, it will create a temporary access point for configuration.
To enable Over-the-Air updates, this configuration includes a password-protected OTA platform:
ota:
- platform: esphome
password: !secret project_name_ota_password
This allows you to upload firmware updates without needing to connect the device via USB.
API communication between the device and Home Assistant (or other services) is encrypted using a secret key.
api:
encryption:
key: !secret project_name_api_encryption_key
The logger
component enables logging to the console, which helps with debugging and troubleshooting.
logger:
This configuration includes two text sensors:
- ESPHome Version: Displays the current version of ESPHome.
- WiFi Info: Shows the IP and MAC addresses of the device.
text_sensor:
- platform: version
name: ESPHome Version - ${friendly_name}
- platform: wifi_info
ip_address:
name: IP - ${friendly_name}
mac_address:
name: MAC - ${friendly_name}
These sensors provide useful information about the device’s status.
This configuration adds a restart button to restart the device from Home Assistant or other systems.
button:
- platform: restart
name: Restart ${friendly_name}
This allows you to trigger a restart of the device remotely.
To customize the configuration:
- Replace
project_name
with your desired device's name. - Update the
friendly_name
to a more readable name for your device. - Choose the appropriate board type for your ESP8266 hardware.
Ensure the secrets.yaml
file contains the following entries:
wifi_ssid: "YourWiFiSSID"
wifi_password: "YourWiFiPassword"
project_name_ap_password: "FallbackAPPassword"
project_name_api_encryption_key: "EncryptionKey"
project_name_ota_password: "OTAPassword"
This keeps sensitive information like WiFi credentials and passwords secure.
- Install ESPHome on your computer or use the web-based ESPHome dashboard.
- Connect your ESP8266 device to your computer via USB.
- Flash the device with this configuration file.
- Once flashed, the device will attempt to connect to your WiFi network. If it fails, it will start the fallback access point for configuration.
This project is licensed under the MIT License - see the LICENSE file for details.