initial commit

This commit is contained in:
2022-12-20 21:26:47 +01:00
commit 2962a6db69
722 changed files with 63886 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import select
from esphome.const import (
CONF_ID,
)
CONF_EHMTX = "ehmtx"
select_ns = cg.esphome_ns.namespace("esphome")
EHMTXSelect = select_ns.class_(
"EhmtxSelect", select.Select, cg.PollingComponent
)
CONFIG_SCHEMA = cv.All(
select.SELECT_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(EHMTXSelect),
}
).extend(cv.polling_component_schema("30s")),
)
async def to_code(config):
cg.add_define("USE_EHMTX_SELECT")
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
await select.register_select(var, config, options=[])

View File

@@ -0,0 +1,33 @@
#include "ehmtx_select.h"
#include "esphome/core/log.h"
namespace esphome {
static const char *const TAG = "ehmtx.select";
void EhmtxSelect::setup() {
this->publish_state("initializing...");
}
void EhmtxSelect::update() {
if (this->parent != NULL) {
std::string value;
value = this->parent->get_current();
this->publish_state(value);
}
}
void EhmtxSelect::dump_config() {
LOG_SELECT(TAG," ", this);
LOG_UPDATE_INTERVAL(this);
}
void EhmtxSelect::control(const std::string &value) {
// value from HA => check if displayable
if (this->parent != NULL) {
ESP_LOGD(TAG, "select control to: %s",value.c_str());
this->parent->force_screen(value.c_str());
}
}
} // namespace esphome

View File

@@ -0,0 +1,22 @@
#pragma once
#include "esphome.h"
namespace esphome {
class EHMTX;
class EhmtxSelect : public select::Select, public PollingComponent {
public:
void setup() override;
void update() override;
void dump_config() override;
float get_setup_priority() const override { return setup_priority::LATE; }
EHMTX *parent;
protected:
void control(const std::string &value) override;
};
}