diff --git a/esphome/components/tfluna/button/__init__.py b/esphome/components/tfluna/button/__init__.py index 753ac7de333..1efc2c487f6 100644 --- a/esphome/components/tfluna/button/__init__.py +++ b/esphome/components/tfluna/button/__init__.py @@ -14,23 +14,21 @@ from esphome.const import ( import esphome.final_validate as fv from esphome.types import ConfigType -from .. import CONF_TFLUNA_ID, FACTORY_DEFAULT_ADDRESS, TFLunaComponent, tfluna_ns +from .. import CONF_TFLUNA_ID, FACTORY_DEFAULT_ADDRESS, TFLunaComponent DEPENDENCIES = ["tfluna"] -ResetButton = tfluna_ns.class_("ResetButton", button.Button) -RestartButton = tfluna_ns.class_("RestartButton", button.Button) CONFIG_SCHEMA = { cv.GenerateID(CONF_TFLUNA_ID): cv.use_id(TFLunaComponent), cv.Optional(CONF_FACTORY_RESET): button.button_schema( - ResetButton, + button.ApplyButton, device_class=DEVICE_CLASS_RESTART, entity_category=ENTITY_CATEGORY_CONFIG, icon=ICON_RESTART_ALERT, ), cv.Optional(CONF_RESTART): button.button_schema( - RestartButton, + button.ApplyButton, device_class=DEVICE_CLASS_RESTART, entity_category=ENTITY_CATEGORY_DIAGNOSTIC, icon=ICON_RESTART, @@ -63,5 +61,5 @@ FINAL_VALIDATE_SCHEMA = _final_validate async def to_code(config: ConfigType) -> None: hub = await cg.get_variable(config[CONF_TFLUNA_ID]) buttons = button.sub_buttons(config, parent=hub) - await buttons(CONF_FACTORY_RESET, hub.set_reset_button) - await buttons(CONF_RESTART, hub.set_restart_button) + await buttons(CONF_FACTORY_RESET, hub.set_reset_button, apply="factory_reset()") + await buttons(CONF_RESTART, hub.set_restart_button, apply="restart()") diff --git a/esphome/components/tfluna/button/reset_button.cpp b/esphome/components/tfluna/button/reset_button.cpp deleted file mode 100644 index b973f668642..00000000000 --- a/esphome/components/tfluna/button/reset_button.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "reset_button.h" - -namespace esphome::tfluna { - -void ResetButton::press_action() { this->parent_->factory_reset(); } - -} // namespace esphome::tfluna diff --git a/esphome/components/tfluna/button/reset_button.h b/esphome/components/tfluna/button/reset_button.h deleted file mode 100644 index a52f479eea0..00000000000 --- a/esphome/components/tfluna/button/reset_button.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "esphome/components/button/button.h" -#include "../tfluna.h" - -namespace esphome::tfluna { - -class ResetButton : public button::Button, public Parented { - protected: - void press_action() override; -}; - -} // namespace esphome::tfluna diff --git a/esphome/components/tfluna/button/restart_button.cpp b/esphome/components/tfluna/button/restart_button.cpp deleted file mode 100644 index 546be2742d8..00000000000 --- a/esphome/components/tfluna/button/restart_button.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "restart_button.h" - -namespace esphome::tfluna { - -void RestartButton::press_action() { this->parent_->restart(); } - -} // namespace esphome::tfluna diff --git a/esphome/components/tfluna/button/restart_button.h b/esphome/components/tfluna/button/restart_button.h deleted file mode 100644 index 7caaebe6b38..00000000000 --- a/esphome/components/tfluna/button/restart_button.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "esphome/components/button/button.h" -#include "../tfluna.h" - -namespace esphome::tfluna { - -class RestartButton : public button::Button, public Parented { - protected: - void press_action() override; -}; - -} // namespace esphome::tfluna