From 3b5fbc359f6fb119a6a820870f36dc4e7a4fd569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Vikstr=C3=B6m?= Date: Sat, 6 Apr 2024 00:29:08 +0200 Subject: [PATCH] Formating updates --- esphome/components/device/__init__.py | 11 +++-------- esphome/components/device/device.h | 4 +++- 2 files changed, 6 insertions(+), 9 deletions(-) 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