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

Internal helpers shared by the hub implementation .cpp files. More...

#include "hub_core.h"
#include "log_frame.h"
#include "esphome/core/log.h"
#include <algorithm>
#include <array>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <map>
#include <string>
#include <vector>
Include dependency graph for hub_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  esphome
namespace  esphome::home_io_control
namespace  esphome::home_io_control::detail

Functions

uint8_t esphome::home_io_control::detail::round_percent (float fraction)
 Convert a 0.0-1.0 HA fraction (position, tilt, or brightness) to a 0-100 IO percent.
bool esphome::home_io_control::detail::is_binary_entity_position (uint8_t position)
 Is the given position value an on/off binary encoding?
bool esphome::home_io_control::detail::known_device_matches_entity_class (const IoDevice &dev, DeviceCapabilityClass expected)
 Does the device's type match the expected HA entity class?
bool esphome::home_io_control::detail::known_device_supports_status_requests (const IoDevice &dev)
 Does the device support status requests?
bool esphome::home_io_control::detail::known_device_accepts_execute_position (const IoDevice &dev, uint8_t position)
 Can this device accept an execute (position) command?
bool esphome::home_io_control::detail::known_device_accepts_execute_tilt (const IoDevice &dev)
 Can this device accept a tilt command?
void esphome::home_io_control::detail::log_rejected_operation (const std::string &device_id, const IoDevice &dev, const char *operation, const char *expected)
 Log a rejected operation with capability mismatch details.
void esphome::home_io_control::detail::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.
void esphome::home_io_control::detail::log_frame_issue (IOHomeControlComponent *component, const char *direction, const char *reason, const IoFrame &frame, uint8_t len)
 Log a frame‑level issue (unregistered endpoints, unsupported commands).
void esphome::home_io_control::detail::log_1w_remote_frame (const OneWayFrameInfo &info, const std::vector< std::string > *linked_devices=nullptr)
 Log an already-decoded 1W remote frame at DEBUG level.
bool esphome::home_io_control::detail::is_exposed_sender (const std::vector< std::string > &exposed_senders, const std::string &sender_id)
 Whether a 1W sender is on the exposed_senders allowlist for the sender HA event.
std::string esphome::home_io_control::detail::format_name_and_hex (const char *name, uint8_t value)
 Format a name/value pair as "name(0xXX)", e.g. "execute(0x00)".
std::string esphome::home_io_control::detail::describe_learned_device_type (DeviceType type)
 Build the YAML line to add once a device's type is learned at runtime.
std::map< std::string, std::string > esphome::home_io_control::detail::build_sender_event_data (const OneWayFrameInfo &info, bool linked)
 Build the Home Assistant event data map for a decoded 1W sender frame.
void esphome::home_io_control::detail::normalize_stopped_state (IoDevice &dev)
 Normalize stopped state: some devices briefly report stopped before target/current converge.
void esphome::home_io_control::detail::update_link_health (IoDevice &dev, RadioDriver *radio)
 Update per-device link-health stats from the radio's last capture.
void esphome::home_io_control::detail::record_exchange_timeout (IoDevice &dev, uint8_t tries)
 Record that an outbound exchange to this device timed out (no valid response).
void esphome::home_io_control::detail::log_status_update (const std::string &id, const IoDevice &dev, const char *suffix="")
 Log a concise status‑update line used by inbound handlers.
void esphome::home_io_control::detail::log_command_result (const std::string &id, uint8_t result, uint8_t request_cmd=0, bool include_request_cmd=false)
 Log a decoded CMD_ERROR_RESP result with optional request-command context.
void esphome::home_io_control::detail::record_command_result (IoDevice &dev, const std::string &id, uint8_t result, uint8_t request_cmd=0, bool include_request_cmd=false)
 Store a decoded CMD_ERROR_RESP result on the device and log it.
void esphome::home_io_control::detail::clear_command_result (IoDevice &dev)
 Clear a previously recorded CMD_ERROR_RESP result, if any.

Variables

constexpr const char * esphome::home_io_control::detail::TAG = "home_io_control"
 Shared log tag for hub-level messages.
constexpr uint32_t esphome::home_io_control::detail::ONEWAY_DEDUP_WINDOW_MS = 2000
 Suppress a repeated 1W log/poll for the same remote and the same intent within this window.
constexpr float esphome::home_io_control::detail::BINARY_ENTITY_ON_POSITION_THRESHOLD
 Shared 0-100 cutoff: values below this mean binary "on".
constexpr const char * esphome::home_io_control::detail::ONEWAY_SENDER_EVENT = "esphome.home_io_control_sender_event"
 Home Assistant event fired when a decoded 1W frame carries a command intent from an exposed sender (a physical remote button press, or a wind/rain sensor's triggered command).
constexpr size_t esphome::home_io_control::detail::NAME_AND_HEX_BUFFER_SIZE = 40
 Buffer size for format_name_and_hex(): longest command name plus "(0xXX)" and a margin.
constexpr size_t esphome::home_io_control::detail::LEARNED_DEVICE_TYPE_HEX_BUFFER_SIZE = 24
 Buffer size for describe_learned_device_type()'s hex fallback: "io_device_type: 0xXX" plus margin.

Detailed Description

Internal helpers shared by the hub implementation .cpp files.

This header is intentionally private to the component implementation. It keeps small cross-file helpers in one place while leaving hub_core.h focused on the public component shape and the member-function declarations.

Definition in file hub_internal.h.