testing esphome components
This commit is contained in:
parent
2b0ae200f6
commit
ae098cbb36
|
@ -1,10 +1,11 @@
|
|||
---
|
||||
|
||||
external_components:
|
||||
- source:
|
||||
type: git
|
||||
url: https://github.com/ratgdo/esphome-ratgdo
|
||||
refresh: 1s
|
||||
type: local
|
||||
path: components
|
||||
# type: git
|
||||
# url: https://github.com/ratgdo/esphome-ratgdo
|
||||
# refresh: 1s
|
||||
|
||||
safe_mode:
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
from esphome.components import output
|
||||
from esphome.const import CONF_ID, CONF_PIN
|
||||
|
||||
from .. import RATGDO_CLIENT_SCHMEA, ratgdo_ns, register_ratgdo_child
|
||||
|
||||
DEPENDENCIES = ["esp32","ratgdo"]
|
||||
|
||||
RATGDOFloatOutput = ratgdo_ns.class_("RATGDOFloatOutput", output.FloatOutput, cg.Component)
|
||||
OutputType = ratgdo_ns.enum("OutputType")
|
||||
|
||||
CONF_TYPE = "type"
|
||||
TYPES = {
|
||||
"test": OutputType.RATGDO_TEST
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
output.FLOAT_OUTPUT_SCHEMA.extend(
|
||||
{
|
||||
cv.Required(CONF_ID): cv.declare_id(RATGDOFloatOutput),
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
cv.Required(CONF_PIN): pins.internal_gpio_output_pin_schema,
|
||||
}
|
||||
)
|
||||
.extend(RATGDO_CLIENT_SCHMEA)
|
||||
)
|
||||
|
||||
async def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await output.register_output(var, config)
|
||||
await cg.register_component(var, config)
|
|
@ -0,0 +1,27 @@
|
|||
#include "esphome/core/log.h"
|
||||
#include "ratgdo_output.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ratgdo {
|
||||
|
||||
static const char *TAG = "ratgdo.output";
|
||||
|
||||
void RATGDOFloatOutput::setup(){
|
||||
ESP_LOGD("yyy","Output was setup");
|
||||
//this->parent_->door_stop();
|
||||
}
|
||||
|
||||
void RATGDOFloatOutput::write_state(float state){
|
||||
|
||||
}
|
||||
|
||||
void RATGDOFloatOutput::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Empty custom float output");
|
||||
}
|
||||
|
||||
void RATGDOFloatOutput::set_output_type(OutputType output_type_) {
|
||||
this->output_type_ = output_type_;
|
||||
}
|
||||
|
||||
} //namespace ratgdo
|
||||
} //namespace esphome
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include "../ratgdo.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/output/float_output.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ratgdo {
|
||||
|
||||
enum OutputType {
|
||||
RATGDO_TEST
|
||||
};
|
||||
|
||||
class RATGDOFloatOutput : public output::FloatOutput, public RATGDOClient, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void write_state(float state) override;
|
||||
void dump_config() override;
|
||||
void set_output_type(OutputType output_type);
|
||||
|
||||
protected:
|
||||
OutputType output_type_;
|
||||
};
|
||||
|
||||
} //namespace ratgdo
|
||||
} //namespace esphome
|
|
@ -0,0 +1,33 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
from esphome.components import output
|
||||
from esphome.const import CONF_ID, CONF_PIN
|
||||
|
||||
from .. import RATGDO_CLIENT_SCHMEA, ratgdo_ns, register_ratgdo_child
|
||||
|
||||
DEPENDENCIES = ["esp32","ratgdo"]
|
||||
|
||||
RATGDOFloatOutput = ratgdo_ns.class_("RATGDOFloatOutput", output.FloatOutput, cg.Component)
|
||||
OutputType = ratgdo_ns.enum("OutputType")
|
||||
|
||||
CONF_TYPE = "type"
|
||||
TYPES = {
|
||||
"test": OutputType.RATGDO_TEST
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = (
|
||||
output.FLOAT_OUTPUT_SCHEMA.extend(
|
||||
{
|
||||
cv.Required(CONF_ID): cv.declare_id(RATGDOFloatOutput),
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
cv.Required(CONF_PIN): pins.internal_gpio_output_pin_schema,
|
||||
}
|
||||
)
|
||||
.extend(RATGDO_CLIENT_SCHMEA)
|
||||
)
|
||||
|
||||
async def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await output.register_output(var, config)
|
||||
await cg.register_component(var, config)
|
|
@ -0,0 +1,27 @@
|
|||
#include "esphome/core/log.h"
|
||||
#include "my_rtttl.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ratgdo {
|
||||
|
||||
static const char *TAG = "my_rtttl";
|
||||
|
||||
void RATGDOFloatOutput::setup(){
|
||||
ESP_LOGD("yyy","Output was setup");
|
||||
this->parent_->door_stop();
|
||||
}
|
||||
|
||||
void RATGDOFloatOutput::write_state(float state){
|
||||
|
||||
}
|
||||
|
||||
void RATGDOFloatOutput::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, "Empty custom float output");
|
||||
}
|
||||
|
||||
void RATGDOFloatOutput::set_output_type(OutputType output_type_) {
|
||||
this->output_type_ = output_type_;
|
||||
}
|
||||
|
||||
} //namespace ratgdo
|
||||
} //namespace esphome
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include "../ratgdo.h"
|
||||
#include "esphome/core/component.h"
|
||||
#include "esphome/components/output/float_output.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace ratgdo {
|
||||
|
||||
enum OutputType {
|
||||
RATGDO_TEST
|
||||
};
|
||||
|
||||
class RATGDOFloatOutput : public output::FloatOutput, public RATGDOClient, public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void write_state(float state) override;
|
||||
void dump_config() override;
|
||||
void set_output_type(OutputType output_type);
|
||||
|
||||
protected:
|
||||
OutputType output_type_;
|
||||
};
|
||||
|
||||
} //namespace ratgdo
|
||||
} //namespace esphome
|
|
@ -0,0 +1,41 @@
|
|||
substitutions:
|
||||
id_prefix: ratgdo32
|
||||
friendly_name: "ratgdo"
|
||||
uart_tx_pin: GPIO22
|
||||
uart_rx_pin: GPIO22
|
||||
input_obst_pin: GPIO22
|
||||
status_door_pin: GPIO22
|
||||
status_obstruction_pin: GPIO22
|
||||
dry_contact_open_pin: GPIO22
|
||||
dry_contact_close_pin: GPIO22
|
||||
dry_contact_light_pin: GPIO22
|
||||
|
||||
esphome:
|
||||
name: esp32-wroom-test
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
|
||||
packages:
|
||||
remote_package: !include
|
||||
file: base.yaml
|
||||
|
||||
web_server:
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_pw
|
||||
|
||||
output:
|
||||
- platform: ratgdo
|
||||
ratgdo_id: ${id_prefix}
|
||||
type: test
|
||||
pin: GPIO33
|
||||
id: ${id_prefix}_output
|
||||
|
||||
rtttl:
|
||||
- platform: ratgdo
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
Loading…
Reference in New Issue