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

IO-Homecontrol device-type model, capabilities and runtime device state. More...

#include "proto_sizes.h"
#include <cstdint>
#include <string>
Include dependency graph for proto_device_model.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::IoDevice
 Runtime state of a paired IO‑Homecontrol device. More...

Namespaces

namespace  esphome
namespace  esphome::home_io_control

Enumerations

enum class  esphome::home_io_control::DeviceType : uint8_t {
  esphome::home_io_control::UNKNOWN = 0x00 , esphome::home_io_control::VENETIAN_BLIND = 0x01 , esphome::home_io_control::ROLLER_SHUTTER = 0x02 , esphome::home_io_control::AWNING = 0x03 ,
  esphome::home_io_control::WINDOW_OPENER = 0x04 , esphome::home_io_control::GARAGE_OPENER = 0x05 , esphome::home_io_control::LIGHT = 0x06 , esphome::home_io_control::GATE_OPENER = 0x07 ,
  esphome::home_io_control::ROLLING_DOOR_OPENER = 0x08 , esphome::home_io_control::LOCK = 0x09 , esphome::home_io_control::BLIND = 0x0A , esphome::home_io_control::SCREEN = 0x0B ,
  esphome::home_io_control::BEACON = 0x0C , esphome::home_io_control::DUAL_SHUTTER = 0x0D , esphome::home_io_control::HEATING_TEMPERATURE_INTERFACE = 0x0E , esphome::home_io_control::ON_OFF_SWITCH = 0x0F ,
  esphome::home_io_control::HORIZONTAL_AWNING = 0x10 , esphome::home_io_control::EXTERNAL_VENETIAN_BLIND = 0x11 , esphome::home_io_control::LOUVRE_BLIND = 0x12 , esphome::home_io_control::CURTAIN_TRACK = 0x13 ,
  esphome::home_io_control::VENTILATION_POINT = 0x14 , esphome::home_io_control::EXTERIOR_HEATING = 0x15 , esphome::home_io_control::HEAT_PUMP = 0x16 , esphome::home_io_control::INTRUSION_ALARM = 0x17 ,
  esphome::home_io_control::SWINGING_SHUTTER = 0x18
}
 Device type identifiers reported by IO‑Homecontrol products. More...
enum class  esphome::home_io_control::DeviceCapabilityClass : uint8_t {
  esphome::home_io_control::UNKNOWN = 0x00 , esphome::home_io_control::COVER = 0x01 , esphome::home_io_control::LIGHT = 0x02 , esphome::home_io_control::SWITCH = 0x03 ,
  esphome::home_io_control::SENSOR = 0x04 , esphome::home_io_control::BEACON = 0x05 , esphome::home_io_control::CLIMATE = 0x06 , esphome::home_io_control::LOCK = 0x07
}
 High‑level capability class derived from DeviceType. More...
enum class  esphome::home_io_control::CoverCommand : uint8_t { esphome::home_io_control::STOP = 0 , esphome::home_io_control::FAVORITE = 1 , esphome::home_io_control::VENT = 2 , esphome::home_io_control::FORCE_OPEN = 3 }
 Named device commands for cover-type actuators. More...

Functions

const char * esphome::home_io_control::device_type_name (DeviceType type)
 Convert a DeviceType to a lowercase string identifier.
const char * esphome::home_io_control::yaml_device_type_name (DeviceType type)
 Return the YAML-friendly device-type name for types exposed in the Python schema.
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_lock_control (DeviceType type)
 Does this device type support binary lock/unlock control via execute commands?
bool esphome::home_io_control::device_supports_tilt (DeviceType type)
 Does this device type support tilt (slat angle) control?
bool esphome::home_io_control::device_supports_vent (DeviceType type)
 Does this device type support the ventilation position command?
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::encode_packed_device_type (DeviceType type, uint8_t subtype, uint8_t &type_msb, uint8_t &type_subtype)
 Encode a DeviceType/subtype pair into the two-byte packed metadata format used by discovery responses — the inverse of decode_packed_device_type()/decode_packed_device_subtype().
const char * esphome::home_io_control::device_operation_profile_name (DeviceType type)
 Human‑readable operation profile name for a device type.
std::string esphome::home_io_control::format_device_type_diagnostic (DeviceType type)
 Human-readable device type string for diagnostics, including the raw numeric value.
std::string esphome::home_io_control::format_device_type_for_yaml (DeviceType type)
 Build the YAML value for a device's io_device_type key.
std::string esphome::home_io_control::build_device_yaml_snippet (DeviceType type, uint8_t subtype, const std::string &device_id, bool metadata_complete, bool inverted)
 Build the ready-to-paste YAML block describing a device, for both a fully-decoded device and one whose type/subtype wasn't reported.
const char * esphome::home_io_control::cover_command_name (CoverCommand cmd)
 Get a human-readable name for a CoverCommand.
int16_t esphome::home_io_control::rssi_scaled_to_dbm (int16_t scaled)
 Convert an rssi_ema_scaled fixed-point value to whole dBm (round half away from zero).
int16_t esphome::home_io_control::device_rssi_ema_dbm (const IoDevice &dev)
 A device's smoothed RSSI in whole dBm.
bool esphome::home_io_control::default_inverted_for_type (DeviceType type)
 Determine whether a device type has inverted position mapping by default.
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.

Variables

static constexpr uint16_t esphome::home_io_control::STATUS_POS_MAX = 0xC800
 In status responses, position is encoded as a 16-bit value where 0x0000 = fully open (0%) and 0xC800 = fully closed (100%).
static constexpr uint16_t esphome::home_io_control::STATUS_POS_TOLERANCE_RAW = 100
 Target-reached tolerance expressed in raw IO-homecontrol position units.
static constexpr uint8_t esphome::home_io_control::DEVICE_METADATA_SIZE = 2
 Packed device metadata uses two bytes where the high 8 bits carry the upper type bits and the low byte carries both the remaining type bits and the 6-bit manufacturer subtype.
static constexpr uint8_t esphome::home_io_control::DEVICE_TYPE_LOW_BITS_SHIFT = 2
static constexpr uint8_t esphome::home_io_control::DEVICE_TYPE_HIGH_BITS_SHIFT = 6
static constexpr uint8_t esphome::home_io_control::DEVICE_SUBTYPE_MASK = 0x3F
static constexpr float esphome::home_io_control::UNKNOWN_POSITION = 212.0F
 Sentinel value meaning "position is not known yet".
static constexpr uint8_t esphome::home_io_control::DEVICE_NAME_BUFFER_SIZE = 32
 Device name storage including null terminator.
static constexpr int16_t esphome::home_io_control::RSSI_UNKNOWN_DBM = INT16_MIN
 Sentinel value meaning "no RSSI sample recorded yet" for last_rssi_dbm/rssi_ema_scaled.
static constexpr int16_t esphome::home_io_control::RSSI_EMA_SCALE = 8
 EMA weight denominator and fixed-point scale for IoDevice::rssi_ema_scaled.

Detailed Description

IO-Homecontrol device-type model, capabilities and runtime device state.

DeviceType/DeviceCapabilityClass, the capability predicates, packed-metadata decoders, cover commands, position/tilt report decoding and the IoDevice runtime struct.

Definition in file proto_device_model.h.