Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
pairing_engine.h File Reference

Device discovery and key-exchange engine for IO-Homecontrol pairing. More...

#include "proto_frame.h"
#include "hub_pairing.h"
#include "hub_decisions.h"
#include "exchange_engine.h"
#include "device_registry.h"
#include "pairing_advisor.h"
#include "pairing_telemetry.h"
#include "radio_interface.h"
#include "tuning_config.h"
#include <cstdint>
#include <string>
Include dependency graph for pairing_engine.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  esphome::home_io_control::PairingEngine
 Owns and drives all three phases of the IO-Homecontrol device pairing flow. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Variables

Pairing timing constants

Timeouts and retry limits for the pairing flow's blocking waits.

constexpr uint32_t esphome::home_io_control::PAIRING_DISCOVERY_RESPONSE_TIMEOUT_MS = 2000
 Discovery wait window after sending 0x28.
constexpr uint8_t esphome::home_io_control::PAIRING_DISCOVERY_MAX_ATTEMPTS = 3
 Retry discovery TX up to this many times.
constexpr uint32_t esphome::home_io_control::PAIRING_KEY_CHALLENGE_TIMEOUT_MS = 500
 Wait window for the device's 0x3C challenge.
constexpr uint32_t esphome::home_io_control::PAIRING_KEY_CONFIRM_TIMEOUT_MS = 500
 Wait for 0x33 key confirm after sending 0x32.
constexpr uint32_t esphome::home_io_control::PAIRING_KEY_CONFIRM_SLICE_MS = 150
 RX slice during key confirm wait (hop each slice).

Detailed Description

Device discovery and key-exchange engine for IO-Homecontrol pairing.

PairingEngine encapsulates all three phases of the IO-Homecontrol pairing flow:

Phase 1 — Discovery (0x28 → 0x29): Controller broadcasts a discovery packet. A device in pairing mode responds with its node ID and type/subtype metadata.

Phase 2 — Authenticated Key Exchange (0x31 → 0x3C → 0x32 → 0x33): The controller sends CMD_KEY_INIT (0x31). The device challenges with 0x3C. The controller proves knowledge of the system key and simultaneously transfers the encrypted system key (0x32). The device confirms with 0x33.

Phase 3 — Configuration (0x6F): The controller sends SetConfig1 to enable automatic device status updates.

The engine is constructed once by IOHomeControlComponent. It holds double-pointer indirection for the radio driver so test assignments (comp.radio_ = &mock) propagate without calling setup(). All radio operations go through ExchangeEngine so that LBT, preamble selection, and frequency hopping are centralised.

PairingEngine is non-copyable and non-movable because it stores pointer and reference addresses that would dangle in a copy.

Definition in file pairing_engine.h.