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

Shared body for the hub-level arming switches. More...

#include <platform_hub_controls.h>

Inheritance diagram for esphome::home_io_control::HubArmingSwitch:
Collaboration diagram for esphome::home_io_control::HubArmingSwitch:

Public Member Functions

void setup () final
 Register the armed-state callback so this entity mirrors the hub's own disarm events.
float get_setup_priority () const final
 Get setup priority so the parent hub is available first.
Public Member Functions inherited from esphome::home_io_control::HubBoundEntity
void set_parent (IOHomeControlComponent *parent)
 Set the parent controller component.

Protected Member Functions

void write_state (bool state) final
 Forward the toggle to the hub and publish the state.
virtual void arm (bool state)=0
 Arm or disarm this switch's listener on the hub.
virtual void subscribe_armed (std::function< void(bool)> callback)=0
 Subscribe callback to the hub's armed-state changes for this listener.

Additional Inherited Members

Protected Attributes inherited from esphome::home_io_control::HubBoundEntity
IOHomeControlComponentparent_ {nullptr}

Detailed Description

Shared body for the hub-level arming switches.

Both arming switches (2W key extraction, 1W controller-key adoption) have the same three behaviours: forward the toggle to the hub, publish the resulting state, and mirror the hub's own disarm events (auto-off timeout, or a successful recovery) so the entity never shows "on" for a window that already closed. Only the two hub calls differ, so those are the two hooks; everything else lives here once.

Deliberately NOT one concrete class parameterized by an enum or a std::function: the two switches arm independent security-sensitive listeners, and keeping them distinct C++ types means "wire the wrong one" is a compile error rather than a codegen bug.

Definition at line 40 of file platform_hub_controls.h.

Member Function Documentation

◆ arm()

virtual void esphome::home_io_control::HubArmingSwitch::arm ( bool state)
protectedpure virtual

◆ get_setup_priority()

float esphome::home_io_control::HubArmingSwitch::get_setup_priority ( ) const
inlinenodiscardfinal

Get setup priority so the parent hub is available first.

Returns
setup_priority::DATA.

Definition at line 48 of file platform_hub_controls.h.

◆ setup()

void esphome::home_io_control::HubArmingSwitch::setup ( )
final

Register the armed-state callback so this entity mirrors the hub's own disarm events.

No-op when no parent is wired (codegen always wires one before setup() runs).

Definition at line 17 of file platform_hub_controls.cpp.

Here is the call graph for this function:

◆ subscribe_armed()

virtual void esphome::home_io_control::HubArmingSwitch::subscribe_armed ( std::function< void(bool)> callback)
protectedpure virtual

Subscribe callback to the hub's armed-state changes for this listener.

Implemented in esphome::home_io_control::IOHomeAcceptForeignPairingSwitch, and esphome::home_io_control::IOHomeRecoverOneWayKeySwitch.

◆ write_state()

void esphome::home_io_control::HubArmingSwitch::write_state ( bool state)
finalprotected

Forward the toggle to the hub and publish the state.

Publishing still happens with no parent wired, so an unwired switch reads as off rather than unknown in Home Assistant.

Definition at line 23 of file platform_hub_controls.cpp.

Here is the call graph for this function:

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