diff --git a/esphome/components/duco/duco.cpp b/esphome/components/duco/duco.cpp index a2cf481a7c..553a20839a 100644 --- a/esphome/components/duco/duco.cpp +++ b/esphome/components/duco/duco.cpp @@ -1,5 +1,4 @@ #include "duco.h" -#include "text_sensor/sensor.h" #include "esphome/core/log.h" #include "esphome/core/helpers.h" #include diff --git a/esphome/components/duco/text_sensor/__init__.py b/esphome/components/duco/text_sensor/__init__.py index 86f99d3500..befb32c73f 100644 --- a/esphome/components/duco/text_sensor/__init__.py +++ b/esphome/components/duco/text_sensor/__init__.py @@ -9,14 +9,14 @@ DEPENDENCIES = ["duco"] CODEOWNERS = ["@kokx"] duco_ns = cg.esphome_ns.namespace("duco") -DucoSensor = duco_ns.class_("DucoSensor", cg.PollingComponent, text_sensor.TextSensor) +DucoSerial = duco_ns.class_("DucoSerial", cg.PollingComponent, text_sensor.TextSensor) CONFIG_SCHEMA = cv.All( - text_sensor.text_sensor_schema(DucoSensor) + text_sensor.text_sensor_schema(DucoSerial) .extend(cv.COMPONENT_SCHEMA) - .extend(cv.polling_component_schema("60s")) + .extend(cv.polling_component_schema("300s")) .extend(DUCO_COMPONENT_SCHEMA) - .extend({cv.GenerateID(): cv.declare_id(DucoSensor)}) + .extend({cv.GenerateID(): cv.declare_id(DucoSerial)}) ) diff --git a/esphome/components/duco/text_sensor/sensor.cpp b/esphome/components/duco/text_sensor/serial.cpp similarity index 78% rename from esphome/components/duco/text_sensor/sensor.cpp rename to esphome/components/duco/text_sensor/serial.cpp index 8ca8d06e11..e337cc8c67 100644 --- a/esphome/components/duco/text_sensor/sensor.cpp +++ b/esphome/components/duco/text_sensor/serial.cpp @@ -1,4 +1,4 @@ -#include "sensor.h" +#include "serial.h" #include "../duco.h" #include @@ -7,20 +7,20 @@ namespace duco { static const char *const TAG = "duco sensor"; -void DucoSensor::setup() {} +void DucoSerial::setup() {} -void DucoSensor::update() { +void DucoSerial::update() { // ask for serial std::vector message = {0x01, 0x01, 0x00, 0x1a, 0x10}; this->parent_->send(0x10, message, this); } -float DucoSensor::get_setup_priority() const { +float DucoSerial::get_setup_priority() const { // After DUCO return setup_priority::BUS - 2.0f; } -void DucoSensor::receive_response(std::vector message) { +void DucoSerial::receive_response(std::vector message) { if (message[1] == 0x12) { // Serial response received, parse it std::string serial(message.begin() + 5, message.end()); diff --git a/esphome/components/duco/text_sensor/sensor.h b/esphome/components/duco/text_sensor/serial.h similarity index 88% rename from esphome/components/duco/text_sensor/sensor.h rename to esphome/components/duco/text_sensor/serial.h index 9ccdb6ff22..2e1eb20c0c 100644 --- a/esphome/components/duco/text_sensor/sensor.h +++ b/esphome/components/duco/text_sensor/serial.h @@ -8,7 +8,7 @@ namespace esphome { namespace duco { -class DucoSensor : public DucoDevice, public PollingComponent, public text_sensor::TextSensor { +class DucoSerial : public DucoDevice, public PollingComponent, public text_sensor::TextSensor { public: void setup() override; void update() override;