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

IO-Homecontrol 2W protocol implementation. More...

#include "proto_frame.h"
#include <cctype>
#include <cmath>
#include <cstdlib>
Include dependency graph for proto_frame.cpp:

Go to the source code of this file.

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Functions

static int esphome::home_io_control::hex_nibble (char ch)
bool esphome::home_io_control::hex_to_bytes (const std::string &hex, uint8_t *out, uint8_t len)
 Convert a hex string (e.g., "123ABC") to a byte array.
std::string esphome::home_io_control::node_id_to_string (const uint8_t id[NODE_ID_SIZE])
 Format a 3‑byte node ID as a 6‑character uppercase hex string.
bool esphome::home_io_control::default_inverted_for_type (DeviceType type)
 Determine whether a device type has inverted position mapping by default.
DeviceType esphome::home_io_control::decode_packed_device_type (uint8_t type_msb, uint8_t type_subtype)
 Decode a protocol-packed device type from two metadata bytes.
uint8_t esphome::home_io_control::decode_packed_device_subtype (uint8_t type_subtype)
 Decode a protocol-packed device subtype from the second metadata byte.
void esphome::home_io_control::decode_position_report (uint16_t target_raw, uint16_t current_raw, bool is_stopped, float &target, float &position)
 Decode target/current position values from a status frame.
bool esphome::home_io_control::has_reached_target_position (float target, float position)
 Has the device reached its target within tolerance?
float esphome::home_io_control::decode_tilt_report (uint16_t tilt_raw)
 Decode tilt angle from raw 16‑bit value.
uint16_t esphome::home_io_control::crc_ccitt (const uint8_t *data, uint8_t len)
 CRC-CCITT used by the IO-Homecontrol protocol for frame validation.
void esphome::home_io_control::init_frame (IoFrame &f, bool is_2w=true, bool start=false, bool end=false, bool low_power=false)
 Initialize an IoFrame header (ctrl0/ctrl1) with flags.
void esphome::home_io_control::set_dst (IoFrame &f, const uint8_t id[NODE_ID_SIZE])
 Set destination node ID.
void esphome::home_io_control::set_src (IoFrame &f, const uint8_t id[NODE_ID_SIZE])
 Set source node ID.
bool esphome::home_io_control::set_cmd (IoFrame &f, uint8_t cmd, const uint8_t *params=nullptr, uint8_t params_len=0)
 Set command and payload.
uint8_t esphome::home_io_control::frame_length (const IoFrame &f)
 Get total frame length from ctrl0.
bool esphome::home_io_control::is_start (const IoFrame &f)
 Check START flag.
bool esphome::home_io_control::is_end (const IoFrame &f)
 Check END flag.
uint8_t esphome::home_io_control::serialize (const IoFrame &f, uint8_t *buf, uint8_t buf_size)
 Serialize a parsed frame into a wire buffer (without CRC).
bool esphome::home_io_control::parse (const uint8_t *buf, uint8_t buf_len, IoFrame &f)
 Parse a wire buffer into a parsed IoFrame (validates length and CTRL0).
const char * esphome::home_io_control::device_type_name (DeviceType type)
 Convert a DeviceType to a lowercase string identifier.
DeviceCapabilityClass esphome::home_io_control::device_capability_class (DeviceType type)
 Map a raw IO‑Homecontrol type to the closest ESPHome/Home Assistant entity family.
const char * esphome::home_io_control::device_capability_class_name (DeviceType type)
 Get a human‑readable name for a capability class.
bool esphome::home_io_control::device_supports_position_control (DeviceType type)
 Does this device type support precise position control (0–100)?
bool esphome::home_io_control::device_supports_binary_control (DeviceType type)
 Does this device type support binary on/off control?
bool esphome::home_io_control::device_supports_status_requests (DeviceType type)
 Does this device type support status request commands (0x03)?
bool esphome::home_io_control::device_supports_tilt (DeviceType type)
 Does this device type support tilt (slat angle) control?
const char * esphome::home_io_control::device_operation_profile_name (DeviceType type)
 Human‑readable operation profile name for a device type.

Detailed Description

IO-Homecontrol 2W protocol implementation.

Definition in file proto_frame.cpp.