8#include "esphome/core/log.h"
13static const char *
const TAG =
"home_io_control.lock";
19 this->
parent_->register_device_callback(
24 this->traits.set_assumed_state(
false);
25 this->traits.set_requires_code(
false);
26 this->traits.set_supports_open(
false);
27 this->traits.set_supported_states(
28 {lock::LOCK_STATE_LOCKED, lock::LOCK_STATE_UNLOCKED, lock::LOCK_STATE_LOCKING, lock::LOCK_STATE_UNLOCKING});
32 const auto state = call.get_state();
33 if (!state.has_value())
36 switch (state.value()) {
37 case lock::LOCK_STATE_LOCKED:
38 case lock::LOCK_STATE_LOCKING:
41 case lock::LOCK_STATE_UNLOCKED:
42 case lock::LOCK_STATE_UNLOCKING:
45 case lock::LOCK_STATE_NONE:
46 case lock::LOCK_STATE_JAMMED:
59 : lock::LOCK_STATE_LOCKING);
65 : lock::LOCK_STATE_LOCKED);
69 LOG_LOCK(
"",
"IO-Homecontrol Lock",
this);
70 ESP_LOGCONFIG(
TAG,
" Device ID: %s", this->
device_id_.c_str());
72 ESP_LOGCONFIG(
TAG,
" Status Poll Interval: default single settle poll");
76 ESP_LOGCONFIG(
TAG,
" Status: experimental and untested");
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_
uint32_t status_poll_interval_ms_
void control(const lock::LockCall &call) override
Apply a Home Assistant lock control request.
void dump_config() override
Dump configuration to the log.
Internal helpers shared by the hub implementation .cpp files.
constexpr uint32_t INITIAL_STATUS_REQUEST_DELAY_MS
Delay before the first post-boot status request from an entity.
constexpr float BINARY_ENTITY_ON_POSITION_THRESHOLD
Shared 0-100 cutoff: values below this mean binary "on".
static constexpr float UNKNOWN_POSITION
Sentinel value meaning "position is not known yet".
static const char *const TAG
Runtime state of a paired IO‑Homecontrol device.
float target
Target position the device is moving toward.
float position
Current position: 0=open, 100=closed, or UNKNOWN_POSITION.
bool is_stopped
True if device is not moving.