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

Internal exchange-state model for hub-owned authenticated non‑pairing flows. More...

#include "proto_frame.h"
#include "radio_interface.h"
#include <cstdint>
#include <string>
Include dependency graph for hub_exchange.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esphome::home_io_control::exchange::OutboundExchangeContext
 Context carried across one outbound authenticated exchange. More...
struct  esphome::home_io_control::exchange::InboundAuthContext
 Context for a single inbound authentication (device‑initiated command). More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control
namespace  esphome::home_io_control::exchange

Enumerations

enum class  esphome::home_io_control::exchange::OutboundExchangeState : uint8_t {
  esphome::home_io_control::exchange::IDLE , esphome::home_io_control::exchange::TX_REQUEST , esphome::home_io_control::exchange::WAIT_FIRST_RESPONSE , esphome::home_io_control::exchange::BUILD_AUTH_RESPONSE ,
  esphome::home_io_control::exchange::TX_AUTH_RESPONSE , esphome::home_io_control::exchange::WAIT_FINAL_RESPONSE , esphome::home_io_control::exchange::SUCCESS , esphome::home_io_control::exchange::FAILED
}
 State machine for an outbound authenticated exchange (non‑pairing). More...
enum class  esphome::home_io_control::exchange::InboundAuthState : uint8_t {
  esphome::home_io_control::exchange::IDLE , esphome::home_io_control::exchange::TX_CHALLENGE , esphome::home_io_control::exchange::WAIT_CHALLENGE_RESPONSE , esphome::home_io_control::exchange::VERIFIED ,
  esphome::home_io_control::exchange::FAILED
}
 State machine for inbound authentication (device‑initiated commands). More...

Detailed Description

Internal exchange-state model for hub-owned authenticated non‑pairing flows.

This module defines the state machines and context structures used for outbound authenticated exchanges (controller → device) and inbound authentication (device → controller). These are the building blocks that power commands like set_position, request_status, and handling unsolicited status‑update frames.

Exchange lifecycle (outbound):

  1. Controller sends a command with START flag (e.g., CMD_EXECUTE, CMD_PRIVATE).
  2. Device may challenge with CMD_CHALLENGE_REQ (0x3C) if it requires auth.
  3. Controller computes HMAC and responds with CMD_CHALLENGE_RESP (0x3D).
  4. Device finally sends the response frame (e.g., CMD_PRIVATE_RESP with position).

Inbound authentication (device-initiated): Device sends a command that requires verification (e.g., CMD_STATUS_UPDATE). Controller challenges with 0x3C, device proves knowledge of system key with 0x3D, controller acknowledges with CMD_STATUS_UPDATE_RESP (0x72).

Both paths rely on the HMAC construction defined in proto_crypto.h which uses AES-128-ECB to encrypt an IV derived from the original frame bytes and a 6-byte random challenge.

Definition in file hub_exchange.h.