Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_lock.h
Go to the documentation of this file.
1#pragma once
2
3/// @file platform_lock.h
4/// @brief Experimental lock entity for IO-Homecontrol lock-capable devices.
5/// @ingroup hioc_platforms
6///
7/// Presents lock and unlock actions through ESPHome's native lock entity model while reusing
8/// the hub's shared execute/status paths.
9/// @todo Validate end-to-end behavior with physical IO-Homecontrol lock devices, including any
10/// vendor-specific status encodings beyond the shared 0/100 binary mapping used here.
11///
12/// @warning This platform has not been tested with physical IO-Homecontrol lock devices.
13/// Behavior is inferred from existing protocol evidence and may need hardware tuning.
14
15#include "esphome/components/lock/lock.h"
16#include "esphome/core/component.h"
17#include "hub_core.h"
18
19namespace esphome {
20namespace home_io_control {
21
22/// @brief Lock entity for IO-Homecontrol lock devices.
23/// @ingroup hioc_platforms
24class IOHomeLock : public lock::Lock, public Component {
25 public:
26 /// @brief Initialize the lock entity and register it with the shared hub.
27 void setup() override;
28 /// @brief Dump configuration to the log.
29 void dump_config() override;
30 /// @brief Get setup priority (DATA).
31 /// @return setup_priority::DATA.
32 [[nodiscard]] float get_setup_priority() const override { return setup_priority::DATA; }
33
34 /// @brief Set parent controller.
35 /// @param parent Pointer to IOHomeControlComponent.
36 void set_parent(IOHomeControlComponent *parent) { this->parent_ = parent; }
37 /// @brief Set device ID from YAML.
38 /// @param id Hex string node ID.
39 void set_device_id(const std::string &id) { this->device_id_ = id; }
40 /// @brief Set the declared device type (from YAML).
41 /// @param type Device type enum.
42 void set_device_type(DeviceType type) { this->device_type_ = type; }
43 /// @brief Set the declared device subtype (from YAML).
44 /// @param subtype Subtype value.
45 void set_subtype(uint8_t subtype) { this->subtype_ = subtype; }
46 /// @brief Configure bounded follow-up polling while a state change is expected.
47 /// @param poll_interval_ms Poll interval in milliseconds; zero keeps the default single settle poll only.
48 void set_status_poll_interval(uint32_t poll_interval_ms) { this->status_poll_interval_ms_ = poll_interval_ms; }
49
50 protected:
51 /// @brief Apply a Home Assistant lock control request.
52 /// @param call Desired state change.
53 void control(const lock::LockCall &call) override;
54 /// @brief Handle inbound device status updates.
55 /// @param id Device ID.
56 /// @param dev Updated device state.
57 void on_device_update_(const std::string &id, const IoDevice &dev);
58
60 std::string device_id_;
62 uint8_t subtype_{0};
64};
65
66} // namespace home_io_control
67} // namespace esphome
The main IO-Homecontrol component.
Definition hub_core.h:68
Lock entity for IO-Homecontrol lock devices.
void set_device_type(DeviceType type)
Set the declared device type (from YAML).
void setup() override
Initialize the lock entity and register it with the shared hub.
void on_device_update_(const std::string &id, const IoDevice &dev)
Handle inbound device status updates.
IOHomeControlComponent * parent_
float get_setup_priority() const override
Get setup priority (DATA).
void set_status_poll_interval(uint32_t poll_interval_ms)
Configure bounded follow-up polling while a state change is expected.
void set_device_id(const std::string &id)
Set device ID from YAML.
void set_parent(IOHomeControlComponent *parent)
Set parent controller.
void set_subtype(uint8_t subtype)
Set the declared device subtype (from YAML).
void control(const lock::LockCall &call) override
Apply a Home Assistant lock control request.
void dump_config() override
Dump configuration to the log.
IO-Homecontrol ESPHome component — protocol controller.
DeviceType
Device type identifiers reported by IO‑Homecontrol products.
@ UNKNOWN
Unknown/unspecified device.
Runtime state of a paired IO‑Homecontrol device.