From 6e96ab5a5de0562edd7fdae3d73eb4754f324a47 Mon Sep 17 00:00:00 2001 From: HB Date: Tue, 29 Sep 2020 23:03:08 +0200 Subject: [PATCH] empty sensor rename --- .../empty_binary_output.cpp | 23 +++++++++++++ .../empty_binary_output.h} | 6 ++-- .../output.py | 6 ++-- .../binary_sensor.py | 6 ++-- .../empty_binary_sensor.cpp | 22 +++++++++++++ .../empty_binary_sensor.h} | 6 ++-- .../empty_custom_binary_output.cpp | 23 ------------- .../empty_custom_binary_sensor.cpp | 22 ------------- .../empty_custom_fan/__init__.py | 3 -- .../empty_custom_float_output.cpp | 23 ------------- .../empty_custom_light/empty_custom_light.cpp | 32 ------------------- .../empty_custom_sensor.cpp | 26 --------------- .../empty_custom_switch.cpp | 22 ------------- custom_components/empty_fan/__init__.py | 3 ++ .../fan/__init__.py | 6 ++-- .../fan/empty_fan.cpp} | 14 ++++---- .../fan/empty_fan.h} | 6 ++-- .../empty_float_output/empty_float_output.cpp | 23 +++++++++++++ .../empty_float_output.h} | 6 ++-- .../output.py | 6 ++-- custom_components/empty_light/empty_light.cpp | 32 +++++++++++++++++++ .../empty_light.h} | 6 ++-- .../light.py | 6 ++-- .../empty_sensor/empty_sensor.cpp | 26 +++++++++++++++ .../empty_sensor.h} | 6 ++-- .../sensor.py | 6 ++-- .../empty_switch/empty_switch.cpp | 22 +++++++++++++ .../empty_switch.h} | 6 ++-- .../switch.py | 6 ++-- test_empty.yaml | 32 +++++++++---------- 30 files changed, 216 insertions(+), 216 deletions(-) create mode 100644 custom_components/empty_binary_output/empty_binary_output.cpp rename custom_components/{empty_custom_binary_output/empty_custom_binary_output.h => empty_binary_output/empty_binary_output.h} (56%) rename custom_components/{empty_custom_binary_output => empty_binary_output}/output.py (55%) rename custom_components/{empty_custom_binary_sensor => empty_binary_sensor}/binary_sensor.py (51%) create mode 100644 custom_components/empty_binary_sensor/empty_binary_sensor.cpp rename custom_components/{empty_custom_binary_sensor/empty_custom_binary_sensor.h => empty_binary_sensor/empty_binary_sensor.h} (53%) delete mode 100644 custom_components/empty_custom_binary_output/empty_custom_binary_output.cpp delete mode 100644 custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.cpp delete mode 100644 custom_components/empty_custom_fan/__init__.py delete mode 100644 custom_components/empty_custom_float_output/empty_custom_float_output.cpp delete mode 100644 custom_components/empty_custom_light/empty_custom_light.cpp delete mode 100644 custom_components/empty_custom_sensor/empty_custom_sensor.cpp delete mode 100644 custom_components/empty_custom_switch/empty_custom_switch.cpp create mode 100644 custom_components/empty_fan/__init__.py rename custom_components/{empty_custom_fan => empty_fan}/fan/__init__.py (82%) rename custom_components/{empty_custom_fan/fan/empty_custom_fan.cpp => empty_fan/fan/empty_fan.cpp} (68%) rename custom_components/{empty_custom_fan/fan/empty_custom_fan.h => empty_fan/fan/empty_fan.h} (79%) create mode 100644 custom_components/empty_float_output/empty_float_output.cpp rename custom_components/{empty_custom_float_output/empty_custom_float_output.h => empty_float_output/empty_float_output.h} (57%) rename custom_components/{empty_custom_float_output => empty_float_output}/output.py (56%) create mode 100644 custom_components/empty_light/empty_light.cpp rename custom_components/{empty_custom_light/empty_custom_light.h => empty_light/empty_light.h} (73%) rename custom_components/{empty_custom_light => empty_light}/light.py (62%) create mode 100644 custom_components/empty_sensor/empty_sensor.cpp rename custom_components/{empty_custom_sensor/empty_custom_sensor.h => empty_sensor/empty_sensor.h} (57%) rename custom_components/{empty_custom_sensor => empty_sensor}/sensor.py (57%) create mode 100644 custom_components/empty_switch/empty_switch.cpp rename custom_components/{empty_custom_switch/empty_custom_switch.h => empty_switch/empty_switch.h} (59%) rename custom_components/{empty_custom_switch => empty_switch}/switch.py (62%) diff --git a/custom_components/empty_binary_output/empty_binary_output.cpp b/custom_components/empty_binary_output/empty_binary_output.cpp new file mode 100644 index 0000000..e3810d1 --- /dev/null +++ b/custom_components/empty_binary_output/empty_binary_output.cpp @@ -0,0 +1,23 @@ +#include "esphome/core/log.h" +#include "empty_binary_output.h" + +namespace esphome { +namespace empty_binary_output { + +static const char *TAG = "empty_binary_output.binary_output"; + +void EmptyBinaryOutput::setup(){ + +} + +void EmptyBinaryOutput::write_state(bool state){ + +} + +void EmptyBinaryOutput::dump_config() { + ESP_LOGCONFIG(TAG, "Custom binary output"); +} + +} //namespace empty_binary_output +} //namespace esphome + diff --git a/custom_components/empty_custom_binary_output/empty_custom_binary_output.h b/custom_components/empty_binary_output/empty_binary_output.h similarity index 56% rename from custom_components/empty_custom_binary_output/empty_custom_binary_output.h rename to custom_components/empty_binary_output/empty_binary_output.h index 9d764d6..5f6a65a 100644 --- a/custom_components/empty_custom_binary_output/empty_custom_binary_output.h +++ b/custom_components/empty_binary_output/empty_binary_output.h @@ -4,9 +4,9 @@ #include "esphome/components/output/binary_output.h" namespace esphome { -namespace empty_custom_binary_output { +namespace empty_binary_output { -class EmptyCustomBinaryOutput : public output::BinaryOutput, public Component { +class EmptyBinaryOutput : public output::BinaryOutput, public Component { public: void setup() override; void write_state(bool state) override; @@ -14,5 +14,5 @@ class EmptyCustomBinaryOutput : public output::BinaryOutput, public Component { }; -} //namespace empty_custom_binary_output +} //namespace empty_binary_output } //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_binary_output/output.py b/custom_components/empty_binary_output/output.py similarity index 55% rename from custom_components/empty_custom_binary_output/output.py rename to custom_components/empty_binary_output/output.py index 257c106..fe0d783 100644 --- a/custom_components/empty_custom_binary_output/output.py +++ b/custom_components/empty_binary_output/output.py @@ -3,12 +3,12 @@ import esphome.config_validation as cv from esphome.components import output from esphome.const import CONF_ID -empty_custom_binary_output_ns = cg.esphome_ns.namespace('empty_custom_binary_output') -EmptyCustomBinaryOutput = empty_custom_binary_output_ns.class_('EmptyCustomBinaryOutput', output.BinaryOutput, +empty_binary_output_ns = cg.esphome_ns.namespace('empty_binary_output') +EmptyBinaryOutput = empty_binary_output_ns.class_('EmptyBinaryOutput', output.BinaryOutput, cg.Component) CONFIG_SCHEMA = output.BINARY_OUTPUT_SCHEMA.extend({ - cv.Required(CONF_ID): cv.declare_id(EmptyCustomBinaryOutput), + cv.Required(CONF_ID): cv.declare_id(EmptyBinaryOutput), }).extend(cv.COMPONENT_SCHEMA) def to_code(config): diff --git a/custom_components/empty_custom_binary_sensor/binary_sensor.py b/custom_components/empty_binary_sensor/binary_sensor.py similarity index 51% rename from custom_components/empty_custom_binary_sensor/binary_sensor.py rename to custom_components/empty_binary_sensor/binary_sensor.py index c40c52f..b5d21c5 100644 --- a/custom_components/empty_custom_binary_sensor/binary_sensor.py +++ b/custom_components/empty_binary_sensor/binary_sensor.py @@ -3,12 +3,12 @@ import esphome.config_validation as cv from esphome.components import binary_sensor from esphome.const import CONF_ID -empty_custom_binary_sensor_ns = cg.esphome_ns.namespace('empty_custom_binary_sensor') +empty_binary_sensor_ns = cg.esphome_ns.namespace('empty_binary_sensor') -EmptyCustomBinarySensor = empty_custom_binary_sensor_ns.class_('EmptyCustomBinarySensor', binary_sensor.BinarySensor, cg.Component) +EmptyBinarySensor = empty_binary_sensor_ns.class_('EmptyBinarySensor', binary_sensor.BinarySensor, cg.Component) CONFIG_SCHEMA = binary_sensor.BINARY_SENSOR_SCHEMA.extend({ - cv.GenerateID(): cv.declare_id(EmptyCustomBinarySensor), + cv.GenerateID(): cv.declare_id(EmptyBinarySensor), }).extend(cv.COMPONENT_SCHEMA) diff --git a/custom_components/empty_binary_sensor/empty_binary_sensor.cpp b/custom_components/empty_binary_sensor/empty_binary_sensor.cpp new file mode 100644 index 0000000..0f92062 --- /dev/null +++ b/custom_components/empty_binary_sensor/empty_binary_sensor.cpp @@ -0,0 +1,22 @@ +#include "esphome/core/log.h" +#include "empty_binary_sensor.h" + +namespace esphome { +namespace empty_binary_sensor { + +static const char *TAG = "empty_binary_sensor.binary_sensor"; + +void EmptyBinarySensor::setup() { + +} + +void EmptyBinarySensor::update() { + +} + +void EmptyBinarySensor::dump_config() { + ESP_LOGCONFIG(TAG, "Custom binary sensor"); +} + +} //namespace empty_binary_sensor +} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.h b/custom_components/empty_binary_sensor/empty_binary_sensor.h similarity index 53% rename from custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.h rename to custom_components/empty_binary_sensor/empty_binary_sensor.h index 459c0ee..d66ce9d 100644 --- a/custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.h +++ b/custom_components/empty_binary_sensor/empty_binary_sensor.h @@ -4,14 +4,14 @@ #include "esphome/components/binary_sensor/binary_sensor.h" namespace esphome { -namespace empty_custom_binary_sensor { +namespace empty_binary_sensor { -class EmptyCustomBinarySensor : public binary_sensor::BinarySensor, public PollingComponent { +class EmptyBinarySensor : public binary_sensor::BinarySensor, public PollingComponent { public: void setup() override; void update() override; void dump_config() override; }; -} //namespace empty_custom_binary_sensor +} //namespace empty_binary_sensor } //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_binary_output/empty_custom_binary_output.cpp b/custom_components/empty_custom_binary_output/empty_custom_binary_output.cpp deleted file mode 100644 index 3a3f4ef..0000000 --- a/custom_components/empty_custom_binary_output/empty_custom_binary_output.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "esphome/core/log.h" -#include "empty_custom_binary_output.h" - -namespace esphome { -namespace empty_custom_binary_output { - -static const char *TAG = "empty_custom_binary_output.binary_output"; - -void EmptyCustomBinaryOutput::setup(){ - -} - -void EmptyCustomBinaryOutput::write_state(bool state){ - -} - -void EmptyCustomBinaryOutput::dump_config() { - ESP_LOGCONFIG(TAG, "Custom binary output"); -} - -} //namespace empty_custom_binary_output -} //namespace esphome - diff --git a/custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.cpp b/custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.cpp deleted file mode 100644 index 09b1e86..0000000 --- a/custom_components/empty_custom_binary_sensor/empty_custom_binary_sensor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "esphome/core/log.h" -#include "empty_custom_binary_sensor.h" - -namespace esphome { -namespace empty_custom_binary_sensor { - -static const char *TAG = "empty_custom_binary_sensor.binary_sensor"; - -void EmptyCustomBinarySensor::setup() { - -} - -void EmptyCustomBinarySensor::update() { - -} - -void EmptyCustomBinarySensor::dump_config() { - ESP_LOGCONFIG(TAG, "Custom binary sensor"); -} - -} //namespace empty_custom_binary_sensor -} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_fan/__init__.py b/custom_components/empty_custom_fan/__init__.py deleted file mode 100644 index ed0015c..0000000 --- a/custom_components/empty_custom_fan/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -import esphome.codegen as cg - -empty_custom_fan_ns = cg.esphome_ns.namespace('empty_custom_fan') \ No newline at end of file diff --git a/custom_components/empty_custom_float_output/empty_custom_float_output.cpp b/custom_components/empty_custom_float_output/empty_custom_float_output.cpp deleted file mode 100644 index 05c5532..0000000 --- a/custom_components/empty_custom_float_output/empty_custom_float_output.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "esphome/core/log.h" -#include "empty_custom_float_output.h" - -namespace esphome { -namespace empty_custom_float_output { - -static const char *TAG = "empty_custom_float_output.output"; - -void EmptyCustomFloatOutput::setup(){ - -} - -void EmptyCustomFloatOutput::write_state(float state){ - -} - -void EmptyCustomFloatOutput::dump_config() { - ESP_LOGCONFIG(TAG, "Empty custom float output"); -} - -} //namespace empty_custom_float_output -} //namespace esphome - diff --git a/custom_components/empty_custom_light/empty_custom_light.cpp b/custom_components/empty_custom_light/empty_custom_light.cpp deleted file mode 100644 index d7c50b8..0000000 --- a/custom_components/empty_custom_light/empty_custom_light.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "esphome/core/log.h" -#include "empty_custom_light.h" - -namespace esphome { -namespace empty_custom_light { - -static const char *TAG = "empty_custom_light.light"; - -void EmptyCustomLightOutput::setup() { - -} - -light::LightTraits EmptyCustomLightOutput::get_traits() { - auto traits = light::LightTraits(); - traits.set_supports_brightness(true); - traits.set_supports_rgb(false); - traits.set_supports_rgb_white_value(false); - traits.set_supports_color_temperature(false); - - return traits; -} - -void EmptyCustomLightOutput::write_state(light::LightState *state) { - -} - -void EmptyCustomLightOutput::dump_config(){ - ESP_LOGCONFIG(TAG, "Empty custom light"); -} - -} //namespace empty_custom_light -} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_sensor/empty_custom_sensor.cpp b/custom_components/empty_custom_sensor/empty_custom_sensor.cpp deleted file mode 100644 index 71d1352..0000000 --- a/custom_components/empty_custom_sensor/empty_custom_sensor.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "esphome/core/log.h" -#include "empty_custom_sensor.h" - -namespace esphome { -namespace empty_custom_sensor { - -static const char *TAG = "empty_custom_sensor.sensor"; - -void EmptyCustomSensor::setup() { - -} - -void EmptyCustomSensor::loop() { - -} - -void EmptyCustomSensor::update() { - -} - -void EmptyCustomSensor::dump_config() { - ESP_LOGCONFIG(TAG, "Empty custom sensor"); -} - -} //namespace empty_custom_sensor -} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_switch/empty_custom_switch.cpp b/custom_components/empty_custom_switch/empty_custom_switch.cpp deleted file mode 100644 index d7e38fc..0000000 --- a/custom_components/empty_custom_switch/empty_custom_switch.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "esphome/core/log.h" -#include "empty_custom_switch.h" - -namespace esphome { -namespace empty_custom_switch { - -static const char *TAG = "empty_custom_switch.switch"; - -void EmptyCustomSwitch::setup() { - -} - -void EmptyCustomSwitch::write_state(bool state) { - -} - -void EmptyCustomSwitch::dump_config(){ - ESP_LOGCONFIG(TAG, "Empty custom switch"); -} - -} //namespace empty_custom_switch -} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_fan/__init__.py b/custom_components/empty_fan/__init__.py new file mode 100644 index 0000000..d23c58e --- /dev/null +++ b/custom_components/empty_fan/__init__.py @@ -0,0 +1,3 @@ +import esphome.codegen as cg + +empty_fan_ns = cg.esphome_ns.namespace('empty_fan') \ No newline at end of file diff --git a/custom_components/empty_custom_fan/fan/__init__.py b/custom_components/empty_fan/fan/__init__.py similarity index 82% rename from custom_components/empty_custom_fan/fan/__init__.py rename to custom_components/empty_fan/fan/__init__.py index d2e4c40..d973c58 100644 --- a/custom_components/empty_custom_fan/fan/__init__.py +++ b/custom_components/empty_fan/fan/__init__.py @@ -3,12 +3,12 @@ import esphome.config_validation as cv from esphome.components import fan, output from esphome.const import CONF_DIRECTION_OUTPUT, CONF_OSCILLATION_OUTPUT, \ CONF_OUTPUT, CONF_OUTPUT_ID -from .. import empty_custom_fan_ns +from .. import empty_fan_ns -EmptyCustomFan = empty_custom_fan_ns.class_('EmptyCustomFan', cg.Component) +EmptyFan = empty_fan_ns.class_('EmptyFan', cg.Component) CONFIG_SCHEMA = fan.FAN_SCHEMA.extend({ - cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(EmptyCustomFan), + cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(EmptyFan), cv.Required(CONF_OUTPUT): cv.use_id(output.BinaryOutput), cv.Optional(CONF_DIRECTION_OUTPUT): cv.use_id(output.BinaryOutput), cv.Optional(CONF_OSCILLATION_OUTPUT): cv.use_id(output.BinaryOutput), diff --git a/custom_components/empty_custom_fan/fan/empty_custom_fan.cpp b/custom_components/empty_fan/fan/empty_fan.cpp similarity index 68% rename from custom_components/empty_custom_fan/fan/empty_custom_fan.cpp rename to custom_components/empty_fan/fan/empty_fan.cpp index 99841ee..0939df0 100644 --- a/custom_components/empty_custom_fan/fan/empty_custom_fan.cpp +++ b/custom_components/empty_fan/fan/empty_fan.cpp @@ -1,12 +1,12 @@ -#include "empty_custom_fan.h" +#include "empty_fan.h" #include "esphome/core/log.h" namespace esphome { -namespace empty_custom_fan { +namespace empty_fan { -static const char *TAG = "empty_custom_fan.fan"; +static const char *TAG = "empty_fan.fan"; -void EmptyCustomFan::setup() { +void EmptyFan::setup() { auto traits = fan::FanTraits(); traits.set_direction(false); traits.set_oscillation(false); @@ -17,7 +17,7 @@ void EmptyCustomFan::setup() { this->fan_->add_on_state_callback([this]() { this->next_update_ = true; }); } -void EmptyCustomFan::loop() { +void EmptyFan::loop() { if (!this->next_update_) { return; //no state change, nothing to do } @@ -26,9 +26,9 @@ void EmptyCustomFan::loop() { //there was a state change, do something here. } -void EmptyCustomFan::dump_config() { +void EmptyFan::dump_config() { ESP_LOGCONFIG(TAG, "Empty fan"); } } // namespace binary -} // namespace empty_custom_fan +} // namespace empty_fan diff --git a/custom_components/empty_custom_fan/fan/empty_custom_fan.h b/custom_components/empty_fan/fan/empty_fan.h similarity index 79% rename from custom_components/empty_custom_fan/fan/empty_custom_fan.h rename to custom_components/empty_fan/fan/empty_fan.h index 43d35dc..85a6f68 100644 --- a/custom_components/empty_custom_fan/fan/empty_custom_fan.h +++ b/custom_components/empty_fan/fan/empty_fan.h @@ -5,9 +5,9 @@ #include "esphome/components/fan/fan_state.h" namespace esphome { -namespace empty_custom_fan { +namespace empty_fan { -class EmptyCustomFan : public Component { +class EmptyFan : public Component { public: void set_fan(fan::FanState *fan) { fan_ = fan; } void set_output(output::BinaryOutput *output) { output_ = output; } @@ -21,5 +21,5 @@ class EmptyCustomFan : public Component { bool next_update_{true}; }; -} // namespace empty_custom_fan +} // namespace empty_fan } // namespace esphome \ No newline at end of file diff --git a/custom_components/empty_float_output/empty_float_output.cpp b/custom_components/empty_float_output/empty_float_output.cpp new file mode 100644 index 0000000..8b3db95 --- /dev/null +++ b/custom_components/empty_float_output/empty_float_output.cpp @@ -0,0 +1,23 @@ +#include "esphome/core/log.h" +#include "empty_float_output.h" + +namespace esphome { +namespace empty_float_output { + +static const char *TAG = "empty_float_output.output"; + +void EmptyFloatOutput::setup(){ + +} + +void EmptyFloatOutput::write_state(float state){ + +} + +void EmptyFloatOutput::dump_config() { + ESP_LOGCONFIG(TAG, "Empty custom float output"); +} + +} //namespace empty_float_output +} //namespace esphome + diff --git a/custom_components/empty_custom_float_output/empty_custom_float_output.h b/custom_components/empty_float_output/empty_float_output.h similarity index 57% rename from custom_components/empty_custom_float_output/empty_custom_float_output.h rename to custom_components/empty_float_output/empty_float_output.h index 29b51fa..2bf97be 100644 --- a/custom_components/empty_custom_float_output/empty_custom_float_output.h +++ b/custom_components/empty_float_output/empty_float_output.h @@ -4,9 +4,9 @@ #include "esphome/components/output/float_output.h" namespace esphome { -namespace empty_custom_float_output { +namespace empty_float_output { -class EmptyCustomFloatOutput : public output::FloatOutput, public Component { +class EmptyFloatOutput : public output::FloatOutput, public Component { public: void setup() override; void write_state(float state) override; @@ -14,5 +14,5 @@ class EmptyCustomFloatOutput : public output::FloatOutput, public Component { }; -} //namespace empty_custom_float_output +} //namespace empty_float_output } //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_float_output/output.py b/custom_components/empty_float_output/output.py similarity index 56% rename from custom_components/empty_custom_float_output/output.py rename to custom_components/empty_float_output/output.py index c6b88da..06b3903 100644 --- a/custom_components/empty_custom_float_output/output.py +++ b/custom_components/empty_float_output/output.py @@ -3,12 +3,12 @@ import esphome.config_validation as cv from esphome.components import output from esphome.const import CONF_ID -empty_custom_float_output_ns = cg.esphome_ns.namespace('empty_custom_float_output') -EmptyCustomFloatOutput = empty_custom_float_output_ns.class_('EmptyCustomFloatOutput', output.FloatOutput, +empty_float_output_ns = cg.esphome_ns.namespace('empty_float_output') +EmptyFloatOutput = empty_float_output_ns.class_('EmptyFloatOutput', output.FloatOutput, cg.Component) CONFIG_SCHEMA = output.FLOAT_OUTPUT_SCHEMA.extend({ - cv.Required(CONF_ID): cv.declare_id(EmptyCustomFloatOutput), + cv.Required(CONF_ID): cv.declare_id(EmptyFloatOutput), }).extend(cv.COMPONENT_SCHEMA) def to_code(config): diff --git a/custom_components/empty_light/empty_light.cpp b/custom_components/empty_light/empty_light.cpp new file mode 100644 index 0000000..ad1d451 --- /dev/null +++ b/custom_components/empty_light/empty_light.cpp @@ -0,0 +1,32 @@ +#include "esphome/core/log.h" +#include "empty_light.h" + +namespace esphome { +namespace empty_light { + +static const char *TAG = "empty_light.light"; + +void EmptyLightOutput::setup() { + +} + +light::LightTraits EmptyLightOutput::get_traits() { + auto traits = light::LightTraits(); + traits.set_supports_brightness(true); + traits.set_supports_rgb(false); + traits.set_supports_rgb_white_value(false); + traits.set_supports_color_temperature(false); + + return traits; +} + +void EmptyLightOutput::write_state(light::LightState *state) { + +} + +void EmptyLightOutput::dump_config(){ + ESP_LOGCONFIG(TAG, "Empty custom light"); +} + +} //namespace empty_light +} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_light/empty_custom_light.h b/custom_components/empty_light/empty_light.h similarity index 73% rename from custom_components/empty_custom_light/empty_custom_light.h rename to custom_components/empty_light/empty_light.h index 6667731..57f0cef 100644 --- a/custom_components/empty_custom_light/empty_custom_light.h +++ b/custom_components/empty_light/empty_light.h @@ -5,9 +5,9 @@ #include "esphome/components/light/light_output.h" namespace esphome { -namespace empty_custom_light { +namespace empty_light { -class EmptyCustomLightOutput : public light::LightOutput, public Component { +class EmptyLightOutput : public light::LightOutput, public Component { public: void setup() override; light::LightTraits get_traits() override; @@ -19,5 +19,5 @@ class EmptyCustomLightOutput : public light::LightOutput, public Component { output::FloatOutput *output_; }; -} //namespace empty_custom_light +} //namespace empty_light } //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_light/light.py b/custom_components/empty_light/light.py similarity index 62% rename from custom_components/empty_custom_light/light.py rename to custom_components/empty_light/light.py index 65f9b8c..2c84a9b 100644 --- a/custom_components/empty_custom_light/light.py +++ b/custom_components/empty_light/light.py @@ -3,11 +3,11 @@ import esphome.config_validation as cv from esphome.components import light, output from esphome.const import CONF_OUTPUT_ID, CONF_OUTPUT -empty_custom_light_ns = cg.esphome_ns.namespace('empty_custom_light') -EmptyCustomLightOutput = empty_custom_light_ns.class_('EmptyCustomLightOutput', light.LightOutput) +empty_light_ns = cg.esphome_ns.namespace('empty_light') +EmptyLightOutput = empty_light_ns.class_('EmptyLightOutput', light.LightOutput) CONFIG_SCHEMA = light.BRIGHTNESS_ONLY_LIGHT_SCHEMA.extend({ - cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(EmptyCustomLightOutput), + cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(EmptyLightOutput), cv.Required(CONF_OUTPUT): cv.use_id(output.FloatOutput) }) diff --git a/custom_components/empty_sensor/empty_sensor.cpp b/custom_components/empty_sensor/empty_sensor.cpp new file mode 100644 index 0000000..bd04f71 --- /dev/null +++ b/custom_components/empty_sensor/empty_sensor.cpp @@ -0,0 +1,26 @@ +#include "esphome/core/log.h" +#include "empty_sensor.h" + +namespace esphome { +namespace empty_sensor { + +static const char *TAG = "empty_sensor.sensor"; + +void EmptySensor::setup() { + +} + +void EmptySensor::loop() { + +} + +void EmptySensor::update() { + +} + +void EmptySensor::dump_config() { + ESP_LOGCONFIG(TAG, "Empty custom sensor"); +} + +} //namespace empty_sensor +} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_sensor/empty_custom_sensor.h b/custom_components/empty_sensor/empty_sensor.h similarity index 57% rename from custom_components/empty_custom_sensor/empty_custom_sensor.h rename to custom_components/empty_sensor/empty_sensor.h index 56e3121..d40e5e9 100644 --- a/custom_components/empty_custom_sensor/empty_custom_sensor.h +++ b/custom_components/empty_sensor/empty_sensor.h @@ -4,14 +4,14 @@ #include "esphome/components/sensor/sensor.h" namespace esphome { -namespace empty_custom_sensor { +namespace empty_sensor { -class EmptyCustomSensor : public sensor::Sensor, public PollingComponent { +class EmptySensor : public sensor::Sensor, public PollingComponent { void setup() override; void loop() override; void update() override; void dump_config() override; }; -} //namespace empty_custom_sensor +} //namespace empty_sensor } //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_sensor/sensor.py b/custom_components/empty_sensor/sensor.py similarity index 57% rename from custom_components/empty_custom_sensor/sensor.py rename to custom_components/empty_sensor/sensor.py index 0190869..fcee0e4 100644 --- a/custom_components/empty_custom_sensor/sensor.py +++ b/custom_components/empty_sensor/sensor.py @@ -3,12 +3,12 @@ import esphome.config_validation as cv from esphome.components import sensor from esphome.const import CONF_ID -empty_custom_sensor_ns = cg.esphome_ns.namespace('empty_custom_sensor') +empty_sensor_ns = cg.esphome_ns.namespace('empty_sensor') -EmptyCustomSensor = empty_custom_sensor_ns.class_('EmptyCustomSensor', cg.PollingComponent) +EmptySensor = empty_sensor_ns.class_('EmptySensor', cg.PollingComponent) CONFIG_SCHEMA = cv.Schema({ - cv.GenerateID(): cv.declare_id(EmptyCustomSensor) + cv.GenerateID(): cv.declare_id(EmptySensor) }).extend(cv.polling_component_schema('60s')) def to_code(config): diff --git a/custom_components/empty_switch/empty_switch.cpp b/custom_components/empty_switch/empty_switch.cpp new file mode 100644 index 0000000..d8b83bd --- /dev/null +++ b/custom_components/empty_switch/empty_switch.cpp @@ -0,0 +1,22 @@ +#include "esphome/core/log.h" +#include "empty_switch.h" + +namespace esphome { +namespace empty_switch { + +static const char *TAG = "empty_switch.switch"; + +void EmptySwitch::setup() { + +} + +void EmptySwitch::write_state(bool state) { + +} + +void EmptySwitch::dump_config(){ + ESP_LOGCONFIG(TAG, "Empty custom switch"); +} + +} //namespace empty_switch +} //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_switch/empty_custom_switch.h b/custom_components/empty_switch/empty_switch.h similarity index 59% rename from custom_components/empty_custom_switch/empty_custom_switch.h rename to custom_components/empty_switch/empty_switch.h index e192b19..9a46fa2 100644 --- a/custom_components/empty_custom_switch/empty_custom_switch.h +++ b/custom_components/empty_switch/empty_switch.h @@ -4,14 +4,14 @@ #include "esphome/components/switch/switch.h" namespace esphome { -namespace empty_custom_switch { +namespace empty_switch { -class EmptyCustomSwitch : public switch_::Switch, public Component { +class EmptySwitch : public switch_::Switch, public Component { public: void setup() override; void write_state(bool state) override; void dump_config() override; }; -} //namespace empty_custom_switch +} //namespace empty_switch } //namespace esphome \ No newline at end of file diff --git a/custom_components/empty_custom_switch/switch.py b/custom_components/empty_switch/switch.py similarity index 62% rename from custom_components/empty_custom_switch/switch.py rename to custom_components/empty_switch/switch.py index b6f6d19..84228dc 100644 --- a/custom_components/empty_custom_switch/switch.py +++ b/custom_components/empty_switch/switch.py @@ -3,11 +3,11 @@ import esphome.config_validation as cv from esphome.components import switch from esphome.const import CONF_ID -empty_custom_switch_ns = cg.esphome_ns.namespace('empty_custom_switch') -EmptyCustomSwitch = empty_custom_switch_ns.class_('EmptyCustomSwitch', switch.Switch, cg.Component) +empty_switch_ns = cg.esphome_ns.namespace('empty_switch') +EmptySwitch = empty_switch_ns.class_('EmptySwitch', switch.Switch, cg.Component) CONFIG_SCHEMA = switch.SWITCH_SCHEMA.extend({ - cv.GenerateID(): cv.declare_id(EmptyCustomSwitch) + cv.GenerateID(): cv.declare_id(EmptySwitch) }).extend(cv.COMPONENT_SCHEMA) def to_code(config): diff --git a/test_empty.yaml b/test_empty.yaml index 2883e24..51d1fbb 100644 --- a/test_empty.yaml +++ b/test_empty.yaml @@ -2,33 +2,33 @@ packages: device: !include device.yaml sensor: - - platform: empty_custom_sensor - id: empty_custom_sensor_1 + - platform: empty_sensor + id: empty_sensor_1 binary_sensor: - - platform: empty_custom_binary_sensor - id: empty_custom_binary_sensor_1 + - platform: empty_binary_sensor + id: empty_binary_sensor_1 output: - - platform: empty_custom_binary_output - id: empty_custom_binary_output_1 + - platform: empty_binary_output + id: empty_binary_output_1 - - platform: empty_custom_float_output - id: empty_custom_float_output_1 + - platform: empty_float_output + id: empty_float_output_1 light: - - platform: empty_custom_light - id: empty_custom_light_1 - output: empty_custom_float_output_1 + - platform: empty_light + id: empty_light_1 + output: empty_float_output_1 switch: - - platform: empty_custom_switch - id: empty_custom_switch_1 + - platform: empty_switch + id: empty_switch_1 fan: - - platform: empty_custom_fan - id: empty_custom_fan_1 - output: empty_custom_binary_output_1 + - platform: empty_fan + id: empty_fan_1 + output: empty_binary_output_1 text_sensor: - platform: empty_text_sensor