Skip to main content

Homey ESPHomeDriver

PyPI version PyPI downloads Python CI License: MIT Ruff Status Homey

This module can be used to make the development of ESPHome apps for Homey easier.

It is essentially a map-tool from Homey-capabilities to ESPHome entities.

This module requires Homey Apps SDK v3.

Related Modules

Installation

$ pip install homey-esphomedriver

Homey apps declare it next to aioesphomeapi in app.json / .homeycompose/app.json:

"pythonPackages": ["aioesphomeapi", "homey-esphomedriver"]

Also checkout [aioesphomeapi](https://github.com/esphome/aioesphomeapi) if you want to talk to the ESPHome Native API directly, without homey-esphomedriver.

$ pip install aioesphomeapi

Changelog

See CHANGELOG.md.

Requirements

This module requires Homey Apps SDK v3 (Python 3.14 runtime).

Usage

Your device should extend EspHomeDevice. This is the class you most likely want to extend from. Your driver should extend EspHomeDriver.

Product identity lives on the Homey driver like Zigbee productId: an esphome object in driver.compose.json. EspHomeDriver reads it from self.manifest. driver.py and device.py can re-export the stock classes when you do not need extra logic.

Driver compose

{
  "name": { "en": "AQ-1" },
  "class": "sensor",
  "$extends": ["esphome-defaults"],
  "esphome": {
    "clientInfo": "Homey EverythingSmart",
    "projects": ["EverythingSmart.AQ-1"],
    "hiddenEntities": ["status_led"],
    "deviceEntities": { "voc": "measure_tvoc" },
    "deviceClassOverrides": { "aq_1": "sensor" },
    "icons": { "sensor": "/drivers/aq-1/assets/icon.svg" }
  }
}
Compose key Python BrandProfile field Purpose
projects projects Exact ESPHome project.name this driver accepts
projectPrefix project_prefix Prefix match such as Brand.
clientInfo client_info Name shown on the node for this Homey client
hiddenEntities hidden_entities Hide extra entities (status LED, OTA helpers)
deviceEntities device_entities Remap an entity to a Homey capability
deviceClassOverrides device_class_overrides Force Homey class from an entity id
icons icons Pairing icon path per Homey class

Omit projects / projectPrefix to accept every project (io.esphome). If both are set, either match is enough.

A class-level brand_profile = BrandProfile(...) on the driver still overrides compose. Use that for after_map.

Driver

# drivers/aq-1/driver.py
from homey_esphomedriver import EspHomeDriver

homey_export = EspHomeDriver

Device

# drivers/aq-1/device.py
from homey_esphomedriver import EspHomeDevice

homey_export = EspHomeDevice

Lifecycle hooks

Core owns on_init and on_uninit on EspHomeDriver and EspHomeDevice. Subclass the hooks below instead — same pattern as homey-oauth2app's onOAuth2Init. Brand app.py exports Homey's App.

Class Override When
EspHomeDriver on_esphome_init / on_esphome_uninit After Flow listeners / before teardown
EspHomeDevice on_esphome_init(client) / on_esphome_uninit After capability wiring; client is None when host is unknown

On a paired device, use self.client for the live EspHomeClient (may exist before the API handshake). Capability commands still require a connected session via _require_client() / available.

Debug logging uses env.json DEBUG; there is no separate class flag.

# drivers/aq-1/device.py
from homey_esphomedriver import EspHomeClient, EspHomeDevice as BaseDevice


class EspHomeDevice(BaseDevice):
    async def on_esphome_init(self, client: EspHomeClient | None) -> None:
        await super().on_esphome_init(client)
        if client is not None:
            self.log(f"API session started for {client.host}")


homey_export = EspHomeDevice

Homey Compose files

Homey Compose runs before Python, so $extends / $template only see files already in the app. When homey-esphomedriver is listed in pythonPackages, Homey CLI copies this package's templates into .homeycompose/ during preprocess (homey app run, build, validate), before compose. That is what makes "$extends": ["esphome-defaults"] and pair "$template": "enter_key" resolve.

Until that CLI is released, or when the package is unpublished, run the same copy by hand:

$ esphome-homey sync

-p / --path selects an app directory other than the current one. sync leaves app.json, app.py, driver.compose.json, and existing driver code alone unless --force.

A brand app is a normal Homey Python app:

$ homey app create
$ homey app dependencies add aioesphomeapi homey-esphomedriver
$ homey app driver create

Then set $extends and the esphome block on each driver's driver.compose.json, add store images, and publish with Homey CLI.

Documentation

See ARCHITECTURE.md for what devices get from Homey and how a brand listing is an esphome compose block on top of this core.

  • [esphome-homey](https://github.com/Doekse/esphome-homey) — generic Homey app (io.esphome; any ESPHome node)

License

MIT. See LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

homey_esphomedriver-0.1.0.tar.gz (199.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

homey_esphomedriver-0.1.0-py3-none-any.whl (267.1 kB view details)

Uploaded Python 3

File details

Details for the file homey_esphomedriver-0.1.0.tar.gz.

File metadata

  • Download URL: homey_esphomedriver-0.1.0.tar.gz
  • Upload date:
  • Size: 199.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for homey_esphomedriver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 176fb9155d70f64fd980336c40329505954abd6fc47c06db30a392386cbf98b2
MD5 819e234b8cd909482a1d0f39921bb3ce
BLAKE2b-256 582eb05d1f45259025ac2da5936abe541cf08a6c2d379af046290d34f8858de8

See more details on using hashes here.

Provenance

The following attestation bundles were made for homey_esphomedriver-0.1.0.tar.gz:

Publisher: publish-pypi.yml on Doekse/homey-esphomedriver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file homey_esphomedriver-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for homey_esphomedriver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57d2147230c43f10a7dcd72f2b44900567f8ef520a3272409b9ddeaf8c0bb8ce
MD5 97b460077671907bf05edcdd13446fac
BLAKE2b-256 d0b6651051482b2c2c833331f802d5aad2bcded6bcc9cdb40176243193cb20e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for homey_esphomedriver-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on Doekse/homey-esphomedriver

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page