mirror of
https://github.com/esphome/esphome.git
synced 2025-02-21 20:38:16 +00:00
Fix template button after abstract press_action (#3250)
This commit is contained in:
parent
a5b4105971
commit
b55e9329d9
@ -1,10 +1,13 @@
|
|||||||
import esphome.config_validation as cv
|
import esphome.config_validation as cv
|
||||||
from esphome.components import button
|
from esphome.components import button
|
||||||
|
|
||||||
|
from .. import template_ns
|
||||||
|
|
||||||
|
TemplateButton = template_ns.class_("TemplateButton", button.Button)
|
||||||
|
|
||||||
CONFIG_SCHEMA = button.BUTTON_SCHEMA.extend(
|
CONFIG_SCHEMA = button.BUTTON_SCHEMA.extend(
|
||||||
{
|
{
|
||||||
cv.GenerateID(): cv.declare_id(button.Button),
|
cv.GenerateID(): cv.declare_id(TemplateButton),
|
||||||
}
|
}
|
||||||
).extend(cv.COMPONENT_SCHEMA)
|
).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…
x
Reference in New Issue
Block a user