Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
platform_lr1121_bootloader_rewrite_switch.cpp
Go to the documentation of this file.
1/// @file platform_lr1121_bootloader_rewrite_switch.cpp
2/// @brief Hub-level "Allow LR1121 Bootloader Rewrite (Irreversible)" switch entity.
3/// @ingroup hioc_platforms
4
6
7#ifdef IOHOME_LR1121_BOOTLOADER_UPDATE
8
9#include "esphome/core/log.h"
10
11namespace esphome {
12namespace home_io_control {
13
14static const char *const TAG = "home_io_control.lr1121_bootloader_switch";
15
16void IOHomeLr1121BootloaderRewriteSwitch::setup() { this->publish_state(false); }
17
18void IOHomeLr1121BootloaderRewriteSwitch::write_state(bool state) {
19 if (this->parent_ != nullptr)
20 this->parent_->set_bootloader_rewrite_allowed(state);
21 this->publish_state(state);
22}
23
24void IOHomeLr1121BootloaderRewriteSwitch::dump_config() {
25 // No irreversibility warning here on purpose: the config dump is not where it lands. The warning
26 // is already on the boot-time AVAILABLE line, on the switch-off refusal, and in the sequence
27 // itself -- i.e. every place a user is about to act on it. Repeating it in a startup dump only
28 // adds noise, and the entity name already carries "(Irreversible)".
29 LOG_SWITCH("", "LR1121 Bootloader Rewrite (Irreversible)", this);
30}
31
32} // namespace home_io_control
33} // namespace esphome
34
35#endif // IOHOME_LR1121_BOOTLOADER_UPDATE
static constexpr const char * TAG
Hub-level arming switch for the LR1121 bootloader-rewrite (three-stage) sequence.