24#include "esphome/core/application.h"
25#include "esphome/core/log.h"
99 std::optional<bool> invert_override,
100 std::function<
void(
const std::string &,
const IoDevice &)> on_update,
101 bool dimmable =
false) {
115 memcpy(config.
system_key, this->system_key_, AES_KEY_SIZE);
122 App.scheduler.set_timeout(self,
"init_status", INITIAL_STATUS_REQUEST_DELAY_MS,
130 if (this->
parent_ !=
nullptr) {
132 return dev->features;
155 ESP_LOGCONFIG(tag,
" Status Poll Interval: device-hinted settle polling (no fixed interval)");
214 if (
const auto *dev = this->
parent_->
get_device(this->device_id_); dev !=
nullptr)
Mixin holding the parent + device-id binding shared by per-device entities that are not full entity p...
void set_parent(IOHomeControlComponent *parent)
Set the parent controller component.
void register_companion_binding_(const std::function< void(const IoDevice &)> &publish)
Shared setup() body: subscribe to this device's updates and publish the initial state.
void set_device_id(const std::string &id)
Set the device ID whose state this companion sensor exposes.
IOHomeControlComponent * parent_
Mixin holding the hub-device binding shared by all IO-Homecontrol entity platforms.
uint8_t system_key_[AES_KEY_SIZE]
Key material: never logged.
TravelSpeed travel_speed_
void set_battery_entities(bool battery_entities)
Record that the YAML declared battery: true, so the status log line names the battery level even when...
void set_travel_speed(TravelSpeed speed)
Set the speed profile of this device's position moves (from YAML travel_speed: or silent:).
void set_low_power(bool low_power)
Mark this device as a low-power / duty-cycled receiver.
void set_status_poll_interval(uint32_t poll_interval_ms)
Configure bounded follow-up polling while a state change is expected.
void set_optimistic_state(bool optimistic_state)
Enable or disable optimistic target updates for this device (from YAML).
void log_poll_interval_config_(const char *tag) const
Emit the shared two-branch poll-interval line for dump_config().
void set_device_model(DeviceModel model)
Set the declared product model below the subtype (YAML io_model:).
void set_device_type(DeviceType type)
Set the declared device type (from YAML).
uint32_t status_poll_interval_ms_
void register_device_binding_(Component *self, DeviceCapabilityClass entity_class, std::optional< bool > invert_override, std::function< void(const std::string &, const IoDevice &)> on_update, bool dimmable=false)
Perform the shared setup() registration ritual.
void set_subtype(uint8_t subtype)
Set the declared device subtype (from YAML).
void set_device_id(const std::string &id)
Set the unique IO-homecontrol device ID (from YAML).
void set_system_key(const std::string &key)
Give this device a system key of its own (system_key: in YAML).
void set_parent(IOHomeControlComponent *parent)
Set the parent controller component.
IOHomeControlComponent * parent_
bool passes_binary_update_filter_(const std::string &id, const IoDevice &dev) const
Shared inbound-update guard for binary endpoints.
DeviceFeatures device_features_(DeviceCapabilityClass entity_class) const
What this entity's device can do: the registered device's features, or, before it is registered,...
Mixin for entities bound to the hub itself rather than to one device.
void set_parent(IOHomeControlComponent *parent)
Set the parent controller component.
IOHomeControlComponent * parent_
The main IO-Homecontrol component.
virtual void register_device_callback(DeviceUpdateCallback cb)
Register a callback invoked when any device updates.
virtual IoDevice * get_device(const std::string &device_id)
Retrieve a device by ID; returns nullptr if not found.
virtual void queue_request_device_status(const std::string &device_id)
Queue an async status request; returns immediately, executed in loop().
virtual void add_device(const std::string &device_id)
Add a device to the registry by device ID only (undeclared/legacy path).
virtual void set_device_status_poll_interval(const std::string &device_id, uint32_t poll_interval_ms)
Configure the optional follow-up polling interval for a registered device.
Mixin for the hub-level entities that additionally scope themselves to one oneway_controllers: identi...
std::string controller_id_
void set_controller_id(const std::string &id)
Set the controller identity this entity acts as / reports on.
IO-Homecontrol ESPHome component — protocol controller.
DeviceModel
A product model below a (node type, subtype): for products that report the same wire type but need di...
@ NONE
No model: the (type, subtype) row.
void resolve_device_features(IoDevice &dev)
Resolve a device's capability bits and inversion from its kind and its YAML overrides.
DeviceType
IO-Homecontrol node types.
@ UNKNOWN
Unknown/unspecified device.
bool effective_is_stopped(const IoDevice &dev)
Whether a consumer should treat the device as at rest, prediction first.
uint16_t DeviceFeatures
Capability bits of a device kind; see device_feature.
DeviceCapabilityClass
High‑level capability class derived from DeviceType.
TravelSpeed
The speed a cover's position moves ask the motor for (ADR 0065).
@ FAST
Profile 0x06, what the hub sends unless a cover says otherwise.
bool hex_to_bytes(const std::string &hex, uint8_t *out, uint8_t len)
Convert a hex string (e.g., "123ABC") to a byte array.
IO-Homecontrol 2W frame container: control bytes, IoFrame and (de)serialization.
YAML-declared device metadata for registration; defaults match an undeclared device.
bool optimistic_state
Whether apply_optimistic_target/apply_optimistic_stop may fire.
bool has_system_key
system_key: declared: the device keeps a key of its own.
DeviceModel model
YAML io_model:; NONE when not declared.
DeviceCapabilityClass entity_class
Class of the declaring entity; decides the features of a kind the type table does not know.
bool low_power
Target is a low-power / duty-cycled receiver: directed frames set CTRL1_LOW_POWER and use the long wa...
bool dimmable
YAML dimmable: true of a light.
uint8_t system_key[AES_KEY_SIZE]
That key; meaningful only when has_system_key. Never logged.
std::optional< bool > invert_override
YAML invert_position: when declared; the kind's default otherwise.
bool battery_entities
battery: true declared: the battery entities exist for this device.
uint8_t subtype
Device subtype byte.
TravelSpeed travel_speed
Speed profile of position moves.
DeviceType type
Device type from YAML declaration.
Runtime state of a paired IO‑Homecontrol device.
DeviceCapabilityClass entity_class
Class of the entity that declared the device; UNKNOWN for a device no entity declared (the type's cla...
DeviceFeatures features
What this device can do, resolved by resolve_device_features().
float position
Current position: 0=open, 100=closed, or UNKNOWN_POSITION.
uint8_t subtype
Device subtype (manufacturer‑specific).
DeviceModel model
YAML-declared product model below the subtype (io_model:); never on the wire.
DeviceType type
Device type (shutter, awning, etc.).