mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 05:54:56 +01:00
Fix template button after abstract press_action (#3250)
This commit is contained in:
parent
a5b4105971
commit
b55e9329d9
2 changed files with 19 additions and 1 deletions
|
@ -1,10 +1,13 @@
|
|||
import esphome.config_validation as cv
|
||||
from esphome.components import button
|
||||
|
||||
from .. import template_ns
|
||||
|
||||
TemplateButton = template_ns.class_("TemplateButton", button.Button)
|
||||
|
||||
CONFIG_SCHEMA = button.BUTTON_SCHEMA.extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(button.Button),
|
||||
cv.GenerateID(): cv.declare_id(TemplateButton),
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
|
15
esphome/components/template/button/template_button.h
Normal file
15
esphome/components/template/button/template_button.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "esphome/components/button/button.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace template_ {
|
||||
|
||||
class TemplateButton : public button::Button {
|
||||
public:
|
||||
// Implements the abstract `press_action` but the `on_press` trigger already handles the press.
|
||||
void press_action() override{};
|
||||
};
|
||||
|
||||
} // namespace template_
|
||||
} // namespace esphome
|
Loading…
Reference in a new issue