diff --git a/esphome/components/device/__init__.py b/esphome/components/device/__init__.py index b21ab7ec23..c7ecbb31f1 100644 --- a/esphome/components/device/__init__.py +++ b/esphome/components/device/__init__.py @@ -2,8 +2,8 @@ from esphome import config_validation as cv from esphome import codegen as cg from esphome.const import CONF_ID, CONF_NAME -# DeviceStruct = cg.esphome_ns.struct("Device") -# StringVar = cg.std_ns.struct("string") +# ns = cg.esphome_ns.namespace("device") +# DeviceClass = ns.Class("Device") StringRef = cg.esphome_ns.struct("StringRef") MULTI_CONF = True @@ -12,8 +12,7 @@ CODEOWNERS = ["@dala318"] CONFIG_SCHEMA = cv.Schema( { - # cv.Required(CONF_ID): cv.declare_id(DeviceStruct), - # cv.Required(CONF_ID): cv.declare_id(StringVar), + # cv.Required(CONF_ID): cv.declare_id(DeviceClass), cv.Required(CONF_ID): cv.declare_id(StringRef), cv.Required(CONF_NAME): cv.string, } @@ -21,10 +20,6 @@ CONFIG_SCHEMA = cv.Schema( async def to_code(config): - # cg.new_variable( - # config[CONF_ID], - # config[CONF_NAME], - # ) cg.new_Pvariable( config[CONF_ID], config[CONF_NAME], diff --git a/esphome/components/device/device.h b/esphome/components/device/device.h index 936c48b0da..49a7b88704 100644 --- a/esphome/components/device/device.h +++ b/esphome/components/device/device.h @@ -1,14 +1,16 @@ #pragma once namespace esphome { +namespace device { class Device { public: void set_name(std::string name) { name_ = name; } - std::string get_name(void) {return name_;} + std::string get_name(void) { return name_; } protected: std::string name_ = ""; }; +} // namespace device } // namespace esphome