mirror of
https://github.com/esphome/esphome.git
synced 2025-09-18 11:12:20 +01:00
Formating updates
This commit is contained in:
@@ -2,8 +2,8 @@ from esphome import config_validation as cv
|
|||||||
from esphome import codegen as cg
|
from esphome import codegen as cg
|
||||||
from esphome.const import CONF_ID, CONF_NAME
|
from esphome.const import CONF_ID, CONF_NAME
|
||||||
|
|
||||||
# DeviceStruct = cg.esphome_ns.struct("Device")
|
# ns = cg.esphome_ns.namespace("device")
|
||||||
# StringVar = cg.std_ns.struct("string")
|
# DeviceClass = ns.Class("Device")
|
||||||
StringRef = cg.esphome_ns.struct("StringRef")
|
StringRef = cg.esphome_ns.struct("StringRef")
|
||||||
|
|
||||||
MULTI_CONF = True
|
MULTI_CONF = True
|
||||||
@@ -12,8 +12,7 @@ CODEOWNERS = ["@dala318"]
|
|||||||
|
|
||||||
CONFIG_SCHEMA = cv.Schema(
|
CONFIG_SCHEMA = cv.Schema(
|
||||||
{
|
{
|
||||||
# cv.Required(CONF_ID): cv.declare_id(DeviceStruct),
|
# cv.Required(CONF_ID): cv.declare_id(DeviceClass),
|
||||||
# cv.Required(CONF_ID): cv.declare_id(StringVar),
|
|
||||||
cv.Required(CONF_ID): cv.declare_id(StringRef),
|
cv.Required(CONF_ID): cv.declare_id(StringRef),
|
||||||
cv.Required(CONF_NAME): cv.string,
|
cv.Required(CONF_NAME): cv.string,
|
||||||
}
|
}
|
||||||
@@ -21,10 +20,6 @@ CONFIG_SCHEMA = cv.Schema(
|
|||||||
|
|
||||||
|
|
||||||
async def to_code(config):
|
async def to_code(config):
|
||||||
# cg.new_variable(
|
|
||||||
# config[CONF_ID],
|
|
||||||
# config[CONF_NAME],
|
|
||||||
# )
|
|
||||||
cg.new_Pvariable(
|
cg.new_Pvariable(
|
||||||
config[CONF_ID],
|
config[CONF_ID],
|
||||||
config[CONF_NAME],
|
config[CONF_NAME],
|
||||||
|
@@ -1,14 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
|
namespace device {
|
||||||
|
|
||||||
class Device {
|
class Device {
|
||||||
public:
|
public:
|
||||||
void set_name(std::string name) { name_ = name; }
|
void set_name(std::string name) { name_ = name; }
|
||||||
std::string get_name(void) {return name_;}
|
std::string get_name(void) { return name_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string name_ = "";
|
std::string name_ = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace device
|
||||||
} // namespace esphome
|
} // namespace esphome
|
||||||
|
Reference in New Issue
Block a user