8#include "esphome/core/log.h"
13static const char *
const TAG =
"home_io_control.lock";
21 this->traits.set_assumed_state(
false);
22 this->traits.set_requires_code(
false);
23 this->traits.set_supports_open(
false);
24 this->traits.set_supported_states(
25 {lock::LOCK_STATE_LOCKED, lock::LOCK_STATE_UNLOCKED, lock::LOCK_STATE_LOCKING, lock::LOCK_STATE_UNLOCKING});
29 const auto state = call.get_state();
30 if (!state.has_value())
33 switch (state.value()) {
34 case lock::LOCK_STATE_LOCKED:
35 case lock::LOCK_STATE_LOCKING:
38 case lock::LOCK_STATE_UNLOCKED:
39 case lock::LOCK_STATE_UNLOCKING:
42 case lock::LOCK_STATE_NONE:
43 case lock::LOCK_STATE_JAMMED:
56 : lock::LOCK_STATE_LOCKING);
62 : lock::LOCK_STATE_LOCKED);
66 LOG_LOCK(
"",
"IO-Homecontrol Lock",
this);
67 ESP_LOGCONFIG(
TAG,
" Device ID: %s", this->
device_id_.c_str());
69 ESP_LOGCONFIG(
TAG,
" Status: experimental and untested");
void register_device_binding_(Component *self, bool inverted, std::function< void(const std::string &, const IoDevice &)> on_update)
Perform the shared setup() registration ritual.
void log_poll_interval_config_(const char *tag) const
Emit the shared two-branch poll-interval line for dump_config().
IOHomeControlComponent * parent_
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.
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 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 constexpr const char * 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.