Reeve Docs

Docs / Reference

ESPHome

The ESPHome plugin (esphome) drives ESPHome nodes over their native protobuf API on TCP 6053. It runs in-process, so it needs no sidecar. The source is in reeve-iot/reeve-common-plugins.

A node has to enable the api: component in its own configuration to be reachable. Lights, switches, climate, cover, fan and lock entities are controllable, and sensors, binary sensors and text sensors report. All switch entities of one node are channels of a single switch device. Other entity kinds become one canonical device each, keyed by the node and the entity.

Configuration

Setting Default Notes
MdnsEnabled true Browse the ESPHome service type on the local segment.
MdnsScanIntervalMinutes 5 How often to scan for new nodes.
StaticHosts empty One host or host:port per line (or comma-separated), default port 6053. Connected in addition to mDNS discovery.
ExportUnknownDevices false Import entities ESPHome cannot classify as devices. They stay visible in the Observed devices view either way.

mDNS only works from a process on the same layer-2 segment as the nodes. In a cluster without host networking or multicast, discovery finds nothing and nodes have to be listed in StaticHosts. See discovery traps. An unreachable static host is retried in the background and does not stop the instance.

Connection behaviour

The plugin pings each node and drops a connection that has been silent for 60 seconds. It reconnects with exponential backoff from one second to a 60-second cap.

Every replica loads the plugin, and the replica that holds a node's connection-ownership lease is the one that connects. A command that reaches another replica is forwarded to the lease holder. If no replica holds the node, the command fails and can safely be sent again. If the holder does not confirm in time, the command is recorded as timed out and may have run, and the plugin never retries it by itself.

API encryption

A node configured with api: encryption: key: accepts only encrypted connections. Give the plugin the node's key with the Set node API encryption key instance action: the node id as shown in the Observed devices view and the base64 key from the node's YAML. The node id is the mac mDNS record for a discovered node and the host as written for a static one. Each node has its own key. The key is stored encrypted, is never logged or shown again, and Remove node API encryption key deletes it.

A node with a stored key is always connected encrypted. The node's status in Observed devices tells you what is wrong when it does not connect:

Status Meaning
Encryption key required The node accepts only encrypted connections and has no key stored. It is not dialled.
Encryption key unavailable The stored key could not be read or is not 32 bytes. The node is not dialled.
Encryption key rejected The node refused the key. The plugin retries with growing backoff.
Encryption not enabled on node The node answered an encrypted hello in plaintext. Remove its key.
A different node answers at this address The MAC in the node's reply differs from the node id. Checked only when the node sends a MAC.

Bluetooth proxy

A node that runs the ESPHome Bluetooth proxy relays the advertisements it hears. The plugin decodes MiBeacon and BTHome advertisements into sensors and ignores everything else. A peripheral becomes a device only after a decoder has extracted a capability from it, so phones and beacons do not flood the device list.

An encrypted sensor needs its AES bindkey before its telemetry can be decrypted. Provision it with the Set device bindkey instance action with the sensor's address as six colon-separated hex bytes and the 32-character hex bindkey. A recognised sensor that still has no key shows up as a bindkey candidate in Observed devices, which keeps at most 64 candidates per node. The plugin keeps at most 512 sensors and forgets one that has been silent for an hour. Advertisements that fail to decode are dropped and counted in reeve_esphome_ble_decode_failures_total.

Operator views

Three read-only views are available on the instance: Observed devices (everything the instance sees, including entities it did not import, with each node's status), Provisioned bindkeys and API encryption keys.

Permissions

The plugin requests the storage permission, which it uses for bindkeys, node encryption keys and the per-node map of switch channel numbers. Channel numbers are assigned once and never reused. Without storage the map only lasts until the plugin restarts.