mirror of
https://github.com/esphome/esphome.git
synced 2026-10-01 00:40:21 +00:00
[zigbee] Use register_apply_action for zigbee.factory_reset (#19690)
This commit is contained in:
@@ -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()"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user