first empty components

This commit is contained in:
HB
2020-09-29 02:16:10 +02:00
parent 889b8027ca
commit 6bf96357eb
24 changed files with 438 additions and 0 deletions
@@ -0,0 +1,17 @@
#include "esphome.h"
#include "empty_custom_switch.h"
namespace esphome {
namespace empty_custom_switch {
void EmptyCustomSwitch::setup() {
}
void EmptyCustomSwitch::write_state(bool state) {
}
} //namespace empty_custom_switch
} //namespace esphome
@@ -0,0 +1,16 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/switch/switch.h"
namespace esphome {
namespace empty_custom_switch {
class EmptyCustomSwitch : public switch_::Switch, public Component {
public:
void setup() override;
void write_state(bool state) override;
};
} //namespace empty_custom_switch
} //namespace esphome
@@ -0,0 +1,16 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import switch
from esphome.const import CONF_ID
empty_custom_switch_ns = cg.esphome_ns.namespace('empty_custom_switch')
EmptyCustomSwitch = empty_custom_switch_ns.class_('EmptyCustomSwitch', switch.Switch, cg.Component)
CONFIG_SCHEMA = switch.SWITCH_SCHEMA.extend({
cv.GenerateID(): cv.declare_id(EmptyCustomSwitch)
}).extend(cv.COMPONENT_SCHEMA)
def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
yield cg.register_component(var, config)
yield switch.register_switch(var, config)