mirror of
https://github.com/esphome/esphome.git
synced 2025-01-22 12:26:01 +01:00
Trying a simple set up
This commit is contained in:
parent
1e2497748d
commit
7736d36f6c
4 changed files with 57 additions and 0 deletions
20
esphome/components/loki/__init__.py
Normal file
20
esphome/components/loki/__init__.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID, CONF_LOKI_HOST
|
||||
|
||||
DEPENDENCIES = ["network"]
|
||||
|
||||
loki_component_ns = cg.esphome_ns.namespace("loki")
|
||||
LokiComponent = loki_component_ns.class_("LokiComponent", cg.Component)
|
||||
|
||||
CONFIG_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(LokiComponent),
|
||||
cv.Optional(CONF_LOKI_HOST): cv.url,
|
||||
}
|
||||
).extend(cv.COMPONENT_SCHEMA)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
var = cg.new_Pvariable(config[CONF_ID])
|
||||
await cg.register_component(var, config)
|
17
esphome/components/loki/loki.cpp
Normal file
17
esphome/components/loki/loki.cpp
Normal file
|
@ -0,0 +1,17 @@
|
|||
#include "loki.h"
|
||||
#ifdef USE_NETWORK
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace loki {
|
||||
|
||||
static const char *TAG = "loki.component";
|
||||
|
||||
void LokiComponent::setup() {}
|
||||
|
||||
void LokiComponent::loop() {}
|
||||
|
||||
void LokiComponent::dump_config() { ESP_LOGCONFIG(TAG, "Loki component"); }
|
||||
|
||||
} // namespace loki
|
||||
} // namespace esphome
|
19
esphome/components/loki/loki.h
Normal file
19
esphome/components/loki/loki.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
#pragma once
|
||||
#include "esphome/core/defines.h"
|
||||
#ifdef USE_NETWORK
|
||||
|
||||
#include "esphome/core/component.h"
|
||||
|
||||
namespace esphome {
|
||||
namespace loki {
|
||||
|
||||
class LokiComponent : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
void dump_config() override;
|
||||
};
|
||||
|
||||
} // namespace loki
|
||||
} // namespace esphome
|
||||
#endif
|
|
@ -453,6 +453,7 @@ CONF_LOG = "log"
|
|||
CONF_LOG_TOPIC = "log_topic"
|
||||
CONF_LOGGER = "logger"
|
||||
CONF_LOGS = "logs"
|
||||
CONF_LOKI_HOST = "loki_host"
|
||||
CONF_LONGITUDE = "longitude"
|
||||
CONF_LOOP_TIME = "loop_time"
|
||||
CONF_LOW = "low"
|
||||
|
|
Loading…
Reference in a new issue