Files
homelab/active/device_esphome/esphome.md
2025-10-14 12:31:14 -04:00

3.6 KiB
Raw Blame History

ESP32

Install

# Check that you have python 3.11 installed
uv python list --only-installed

# Create the venv (python 3.11 is recommended in the docs)
uv venv --python 3.11

# Install esphome
uv pip install esphome wheel pip
source .venv/bin/activate

Devices

Lilygo tdongle

Display: 80 X 160

Local Flashing

Make sure your permissions are set correctly

sudo usermod -a -G dialout ducoterra

Then "run" your config file

cd active/device_esp32
uv venv
uv pip install esphome
source .venv/bin/activate

esphome run m5stack-atom-echo.yaml

Adding a New Device

  1. Create a new yaml configuration file called "my-device-device-type.yaml"

Controlling Home Assistant

https://esphome.io/components/api/#api-actions

Configuration Sections

https://esphome.io/components/

esphome

esp32

https://esphome.io/components/esp32/#configuration-variables

logger

https://esphome.io/components/logger/

api

https://esphome.io/components/api/

wifi

https://esphome.io/components/wifi/

ota

https://esphome.io/components/ota/

https://esphome.io/components/ota/esphome/

captive portal

https://esphome.io/components/captive_portal/

button

https://esphome.io/components/button/

i2s audio

https://esphome.io/components/i2s_audio/

microphone

https://esphome.io/components/microphone/

https://esphome.io/components/microphone/i2s_audio/

speaker

https://esphome.io/components/speaker/i2s_audio/

media player

https://esphome.io/components/media_player/speaker/

Sometimes you'll need to convert media files to supported encoders.

ffmpeg -i input.flac output.wav

To play media on other devices from home assistant, put the

action: media_player.play_media
target:
  entity_id: media_player.kitchen_google_home
data:
  media_content_type: "audio/wav"
  media_content_id: "media-source://media_source/local/wake_word_triggered.wav"

voice assistant

https://esphome.io/components/voice_assistant/

In Home Assistant's configuration.yaml, add the following to listen to audio recordings of your voice request:

assist_pipeline:
   debug_recording_dir: /share/assist_pipeline

micro wake word

https://esphome.io/components/micro_wake_word/

light

https://esphome.io/components/light/#light-effects

binary sensor

https://esphome.io/components/binary_sensor/

lambda

https://esphome.io/automations/templates/#config-lambda

id(...) is a helper function that makes ESPHome fetch an object with the supplied ID (which you defined somewhere else, like top_end_stop ) and lets you call any of ESPHomes many APIs directly. For example, here were retrieving the current state of the end stop using .state and using it to construct our cover state.