15#include "esphome/core/log.h"
31inline constexpr const char *
TAG =
"home_io_control";
42 std::array<char, NAME_AND_HEX_BUFFER_SIZE> buffer{};
43 std::snprintf(buffer.data(), buffer.size(),
"%s(0x%02X)", name, value);
44 return std::string(buffer.data());
63 out.reserve(AES_KEY_SIZE * 2);
65 for (uint8_t i = 0; i < AES_KEY_SIZE; i++) {
66 snprintf(byte_buf,
sizeof(byte_buf),
"%02X", key[i]);
84 const IoFrame *frame =
nullptr) {
91 if (frame !=
nullptr) {
92 ESP_LOGD(
"io_capture",
93 "chip=%s phase=component stage=%s freq=%" PRIu32
" ts=%" PRIu32
94 " len=%u cmd=0x%02X src=%02X%02X%02X dst=%02X%02X%02X payload=%s",
96 frame->src[1], frame->src[2], frame->dst[0], frame->dst[1], frame->dst[2], payload_hex);
99 ESP_LOGD(
"io_capture",
"chip=%s phase=component stage=%s freq=%" PRIu32
" ts=%" PRIu32
" len=%u payload=%s",
120 const std::string &message) {
124 const size_t end = message.find(
'\n', start);
125 const std::string line = (end == std::string::npos) ? message.substr(start) : message.substr(start, end - start);
126 const std::string out = first ? prefix + line : line;
128 ESP_LOGW(tag,
"%s", out.c_str());
130 ESP_LOGI(tag,
"%s", out.c_str());
133 if (end == std::string::npos || end + 1 >= message.size())
Abstract radio driver for IO-Homecontrol.
const RadioCaptureInfo & get_last_capture() const
Get the most recent radio capture info.
virtual const char * chip_name() const =0
Get a human‑readable chip name.
Shared frame logging helpers for IO-Homecontrol.
std::string format_name_and_hex(const char *name, uint8_t value)
Format a name/value pair as "name(0xXX)", e.g. "execute(0x00)".
constexpr const char * TAG
Shared log tag for hub-level messages.
constexpr size_t NAME_AND_HEX_BUFFER_SIZE
Buffer size for format_name_and_hex(): longest command name plus "(0xXX)" and a margin.
void log_multiline_result(const char *tag, bool is_warning, const std::string &prefix, const std::string &message)
Log prefix followed by message, one line per log call rather than one call for the whole (possibly mu...
void log_component_capture(const RadioDriver *radio, const char *stage, const uint8_t *buf, uint8_t len, const IoFrame *frame=nullptr)
Log a frame at the "io_capture" tag with structured fields.
std::string format_key_hex(const uint8_t key[AES_KEY_SIZE])
Format a 16-byte key as an uppercase, unseparated hex string for display.
void render_frame_hex_redacted(const uint8_t *data, uint8_t len, char *out, size_t out_size)
Render a frame's bytes as spaced hex text, masking the payload when the command carries key material ...
constexpr size_t FRAME_LOG_HEX_BUFFER_SIZE
Fits a full 32-byte frame rendered as spaced hex text.
IO-Homecontrol 2W frame container: control bytes, IoFrame and (de)serialization.
Fundamental IO-Homecontrol frame and crypto size constants.
Radio abstraction layer for IO-Homecontrol.
Parsed IO‑Homecontrol frame (CTRL0/1 + addresses + command + data).
Diagnostic capture from a radio operation.
uint32_t timestamp_ms
Timestamp of capture (millis).
uint32_t freq_hz
RF frequency of capture (Hz).