Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_lr1121_firmware_update_button.h
Go to the documentation of this file.
1#pragma once
2
3/// @file platform_lr1121_firmware_update_button.h
4/// @brief Hub-level button that triggers the LR1121 transceiver-firmware flash sequence.
5/// @ingroup hioc_platforms
6///
7/// Like IOHomeAcceptForeignPairingSwitch, this entity is hub-level, not device-bound — it has no
8/// `io_device_id` and isn't declared through a separate platform entry. It is created dynamically
9/// from the presence of `home_io_control.lr1121_firmware_update:` (see `__init__.py`'s
10/// `_create_lr1121_firmware_update()`), bound directly to the hub instance being built. See
11/// hub_lr1121_firmware_update.cpp for what a press actually does — every rejection path is a
12/// cached-verdict log, not a fresh bootloader entry. Once a press does proceed, ADR 0020's
13/// invariant applies: every exit after a bootloader excursion reboots the ESP32.
14
15// IOHOME_LR1121_FIRMWARE_UPDATE is only visible after something pulls in esphome/core/defines.h
16// (via hub_core.h's own #include "esphome/core/hal.h") — these #includes must run before the
17// #ifdef check, not after (see radio_lr1121_firmware_updater.h for the fuller explanation of why
18// this ordering matters and how it stayed invisible in host unit tests).
19#include "esphome/components/button/button.h"
20#include "hub_core.h"
21
22#ifdef IOHOME_LR1121_FIRMWARE_UPDATE
23
24namespace esphome {
25namespace home_io_control {
26
27/// @brief Hub-level button entity: press dispatches to
28/// IOHomeControlComponent::trigger_lr1121_firmware_update().
29/// @ingroup hioc_platforms
30class IOHomeLr1121FirmwareUpdateButton : public button::Button, public Component {
31 public:
32 /// @brief Set the parent controller component.
33 /// @param parent Pointer to the IOHomeControlComponent instance.
34 void set_parent(IOHomeControlComponent *parent) { this->parent_ = parent; }
35 void dump_config() override {}
36
37 protected:
38 /// @brief When pressed, hand off to the hub — see hub_lr1121_firmware_update.cpp for the full
39 /// guard/decision/flash sequence.
40 void press_action() override { this->parent_->trigger_lr1121_firmware_update(); }
41 IOHomeControlComponent *parent_{nullptr};
42};
43
44} // namespace home_io_control
45} // namespace esphome
46
47#endif // IOHOME_LR1121_FIRMWARE_UPDATE
IO-Homecontrol ESPHome component — protocol controller.
IOHomeLr1121FirmwareUpdateButton
Definition __init__.py:102