Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
esphome::home_io_control::OnewayKeyAdoption Class Reference

Opt-in, receive-only listener that adopts an overheard 1W controller key. More...

#include <oneway_key_adoption.h>

Collaboration diagram for esphome::home_io_control::OnewayKeyAdoption:

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.
OnewayKeyAdoptionoperator= (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 ObservedClasslast_observed_class () const

Detailed Description

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.

Constructor & Destructor Documentation

◆ OnewayKeyAdoption() [1/2]

esphome::home_io_control::OnewayKeyAdoption::OnewayKeyAdoption ( NamedTimeoutFn schedule_auto_off)
inlineexplicit
Parameters
schedule_auto_offNamed-timeout scheduler for the 10-minute arm window (see NamedTimeoutFn).

Definition at line 31 of file oneway_key_adoption.h.

◆ OnewayKeyAdoption() [2/2]

esphome::home_io_control::OnewayKeyAdoption::OnewayKeyAdoption ( const OnewayKeyAdoption & )
delete

Non-copyable — holds an injected callback and is owned by the hub.

Here is the call graph for this function:

Member Function Documentation

◆ armed()

bool esphome::home_io_control::OnewayKeyAdoption::armed ( ) const
inlinenodiscard

Whether the listener is currently armed.

Definition at line 46 of file oneway_key_adoption.h.

◆ last_observed_class()

const ObservedClass & esphome::home_io_control::OnewayKeyAdoption::last_observed_class ( ) const
inlinenodiscard
Returns
The most recent observed class (see ObservedClass).

Definition at line 73 of file oneway_key_adoption.h.

◆ operator=()

OnewayKeyAdoption & esphome::home_io_control::OnewayKeyAdoption::operator= ( const OnewayKeyAdoption & )
delete
Here is the call graph for this function:

◆ record_observed_class()

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.

Parameters
infoAlready-decoded 1W frame info (see decode_1w_frame()).

Definition at line 82 of file oneway_key_adoption.cpp.

◆ set_armed()

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().

Parameters
armedDesired state.

Definition at line 47 of file oneway_key_adoption.cpp.

Here is the call graph for this function:

◆ set_armed_callback()

void esphome::home_io_control::OnewayKeyAdoption::set_armed_callback ( std::function< void(bool)> cb)
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.

Parameters
cbCallable receiving the new armed state.

Definition at line 51 of file oneway_key_adoption.h.

◆ try_adopt()

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.

Parameters
frameParsed inbound 1W frame.

Definition at line 95 of file oneway_key_adoption.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: