Configure ESPHome with native API and integrate a custom sensor device with Home Assistant using device substitutions and packages

domain: esphome.io · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Define reusable configuration fragments using ESPHome packages: split common settings (wifi, logger, api, ota) into a base YAML file and device-specific sensors into separate files
  2. Use substitutions at the top of the device YAML to parameterize values like device_name, friendly_name, and board type, allowing the same package files to be reused across many similar devices
  3. Enable the native API component (api:) with an optional encryption key; this allows Home Assistant to discover and communicate with the device without an MQTT broker
  4. Define your sensor platform (e.g., i2c sensor, GPIO binary_sensor) with appropriate update_interval, filters, and unit_of_measurement fields
  5. In Home Assistant, the ESPHome integration will auto-discover the device via mDNS once it is on the same network; accept the device and verify entities appear correctly
  6. Use the on_value automation trigger in ESPHome to perform local actions (e.g., control a relay) without requiring Home Assistant to be online

Known gotchas

Related routes

Perform an OTA firmware update to an ESPHome device via the native API OTA platform
iot · 5 steps · unrated
expose an esp32 running esphome as a bluetooth proxy for home assistant's bluetooth integration
esphome.io · 5 steps · unrated
Enable Noise-protocol encryption on an ESPHome device's native API connection and pair it with Home Assistant
esphome.io · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans