[zigbee] Use register_apply_action for zigbee.factory_reset (#19690)

This commit is contained in:
J. Nick Koston
2026-09-25 20:31:05 -04:00
committed by GitHub
parent 532a6ed239
commit c0c1643efe
2 changed files with 2 additions and 28 deletions
+2 -9
View File
@@ -30,7 +30,6 @@ from .const import (
POWER_SOURCE, POWER_SOURCE,
REPORT, REPORT,
ZigbeeComponent, ZigbeeComponent,
zigbee_ns,
) )
from .const_zephyr import ( from .const_zephyr import (
CONF_IEEE802154_VENDOR_OUI, CONF_IEEE802154_VENDOR_OUI,
@@ -293,14 +292,8 @@ ZIGBEE_ACTION_SCHEMA = automation.maybe_simple_id(
) )
) )
FactoryResetAction = zigbee_ns.class_( automation.register_apply_action(
"FactoryResetAction", automation.Action, cg.Parented.template(ZigbeeComponent)
)
automation.register_parented_action(
"zigbee.factory_reset", "zigbee.factory_reset",
FactoryResetAction,
ZIGBEE_ACTION_SCHEMA, ZIGBEE_ACTION_SCHEMA,
synchronous=True, automation.ApplyCall("factory_reset()"),
) )
-19
View File
@@ -1,19 +0,0 @@
#pragma once
#include "esphome/core/defines.h"
#ifdef USE_ZIGBEE
#ifdef USE_ESP32
#include "zigbee_esp32.h"
#endif
#ifdef USE_NRF52
#include "zigbee_zephyr.h"
#endif
namespace esphome::zigbee {
template<typename... Ts> class FactoryResetAction final : public Action<Ts...>, public Parented<ZigbeeComponent> {
public:
void play(const Ts &...x) override { this->parent_->factory_reset(); }
};
} // namespace esphome::zigbee
#endif