From 776a7f68d833b193049472bb75b3a44d37eeab44 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Oct 2026 10:47:41 -1000 Subject: [PATCH] [tfluna] Use Apply entities for the buttons --- esphome/components/tfluna/button/__init__.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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()")