|
Home IO Control
ESPHome add-on for IO-Homecontrol devices
|
Opt-in, receive-only listener that adopts an overheard 1W controller key. More...
#include <oneway_key_adoption.h>
Classes | |
| struct | ObservedClass |
| Most recent 1W target device class observed while armed. More... | |
Public Member Functions | |
| OnewayKeyAdoption (NamedTimeoutFn schedule_auto_off) | |
| OnewayKeyAdoption (const OnewayKeyAdoption &)=delete | |
| Non-copyable — holds an injected callback and is owned by the hub. | |
| OnewayKeyAdoption & | operator= (const OnewayKeyAdoption &)=delete |
| void | set_armed (bool armed) |
| Arm or disarm the 1W controller-key adoption listener. | |
| bool | armed () const |
| Whether the listener is currently armed. | |
| void | set_armed_callback (std::function< void(bool)> cb) |
| Register a callback invoked whenever the armed state changes (manual toggle, successful adoption, or auto-off), so the switch entity stays in sync when the listener disarms itself. | |
| void | record_observed_class (const OneWayFrameInfo &info) |
| Remember the most recent 1W target device class observed from info.src, for the adoption report's io_device_type prefill. | |
| void | try_adopt (const IoFrame &frame) |
| Decode an inbound CMD_ONEWAY_ADD_CONTROLLER (0x30) while armed, report the result, and disarm. | |
| const ObservedClass & | last_observed_class () const |
Opt-in, receive-only listener that adopts an overheard 1W controller key.
Receive-only: nothing here transmits. While armed, an overheard CMD_ONEWAY_ADD_CONTROLLER broadcast is decrypted and reported once, after which the listener disarms itself — one adoption per arm. Constructed once by IOHomeControlComponent; non-copyable because it is wired with an injected scheduling callback.
Definition at line 28 of file oneway_key_adoption.h.
|
inlineexplicit |
| schedule_auto_off | Named-timeout scheduler for the 10-minute arm window (see NamedTimeoutFn). |
Definition at line 31 of file oneway_key_adoption.h.
|
delete |
Non-copyable — holds an injected callback and is owned by the hub.
|
inlinenodiscard |
Whether the listener is currently armed.
Definition at line 46 of file oneway_key_adoption.h.
|
inlinenodiscard |
Definition at line 73 of file oneway_key_adoption.h.
|
delete |
| void esphome::home_io_control::OnewayKeyAdoption::record_observed_class | ( | const OneWayFrameInfo & | info | ) |
Remember the most recent 1W target device class observed from info.src, for the adoption report's io_device_type prefill.
No-op unless armed and info.target_type is a real class.
| info | Already-decoded 1W frame info (see decode_1w_frame()). |
Definition at line 82 of file oneway_key_adoption.cpp.
| void esphome::home_io_control::OnewayKeyAdoption::set_armed | ( | bool | armed | ) |
Arm or disarm the 1W controller-key adoption listener.
Arming resets any class observed in an earlier window and schedules a 10-minute auto-off. Disarming — manual, on successful adoption, or on auto-off — is immediate. See the class doc comment; this is the body that was IOHomeControlComponent::set_oneway_key_adoption_armed().
| armed | Desired state. |
Definition at line 47 of file oneway_key_adoption.cpp.
|
inline |
Register a callback invoked whenever the armed state changes (manual toggle, successful adoption, or auto-off), so the switch entity stays in sync when the listener disarms itself.
| cb | Callable receiving the new armed state. |
Definition at line 51 of file oneway_key_adoption.h.
| void esphome::home_io_control::OnewayKeyAdoption::try_adopt | ( | const IoFrame & | frame | ) |
Decode an inbound CMD_ONEWAY_ADD_CONTROLLER (0x30) while armed, report the result, and disarm.
Returns nothing and never consumes the frame — the caller still runs it through the normal 1W logging path.
| frame | Parsed inbound 1W frame. |
Definition at line 95 of file oneway_key_adoption.cpp.