From a8ed21ae7469943ea6ca544200d9b0cc1f30fe86 Mon Sep 17 00:00:00 2001 From: j0ta29 Date: Wed, 25 Oct 2023 13:42:10 +0000 Subject: [PATCH] get rid of most AUTOLOADs in optolink component --- esphome/components/optolink/__init__.py | 4 ++-- esphome/components/optolink/binary_sensor/__init__.py | 4 ++++ esphome/components/optolink/number/__init__.py | 4 ++++ esphome/components/optolink/optolink.cpp | 1 + esphome/components/optolink/optolink.h | 2 -- esphome/components/optolink/select/__init__.py | 4 ++++ esphome/components/optolink/sensor/__init__.py | 4 ++++ esphome/components/optolink/switch/__init__.py | 4 ++++ esphome/components/optolink/text_sensor/__init__.py | 3 ++- 9 files changed, 25 insertions(+), 5 deletions(-) diff --git a/esphome/components/optolink/__init__.py b/esphome/components/optolink/__init__.py index 4377f4c5e6..deb268f981 100644 --- a/esphome/components/optolink/__init__.py +++ b/esphome/components/optolink/__init__.py @@ -17,8 +17,8 @@ from esphome.const import ( from esphome.core import CORE CODEOWNERS = ["@j0ta29"] -DEPENDENCIES = [] -AUTO_LOAD = ["sensor", "binary_sensor", "text_sensor", "number", "select", "switch"] +DEPENDENCIES = ["text_sensor"] +AUTO_LOAD = [] MULTI_CONF = False CONF_DEVICE_INFO = "device_info" diff --git a/esphome/components/optolink/binary_sensor/__init__.py b/esphome/components/optolink/binary_sensor/__init__.py index 4f20fca563..7eb50287e4 100644 --- a/esphome/components/optolink/binary_sensor/__init__.py +++ b/esphome/components/optolink/binary_sensor/__init__.py @@ -3,6 +3,10 @@ from esphome.components import binary_sensor from esphome.const import CONF_ADDRESS, CONF_ID from .. import SENSOR_BASE_SCHEMA, optolink_ns, CONF_OPTOLINK_ID +DEPENDENCIES = ["optolink"] +CODEOWNERS = ["@j0ta29"] + + OptolinkBinarySensor = optolink_ns.class_( "OptolinkBinarySensor", binary_sensor.BinarySensor, cg.PollingComponent ) diff --git a/esphome/components/optolink/number/__init__.py b/esphome/components/optolink/number/__init__.py index 5e81852e33..c1c21a1724 100644 --- a/esphome/components/optolink/number/__init__.py +++ b/esphome/components/optolink/number/__init__.py @@ -12,6 +12,10 @@ from esphome.const import ( ) from .. import optolink_ns, CONF_OPTOLINK_ID, SENSOR_BASE_SCHEMA + +DEPENDENCIES = ["optolink"] +CODEOWNERS = ["@j0ta29"] + OptolinkNumber = optolink_ns.class_( "OptolinkNumber", number.Number, cg.PollingComponent ) diff --git a/esphome/components/optolink/optolink.cpp b/esphome/components/optolink/optolink.cpp index d421bcc952..52f7bf9d5f 100644 --- a/esphome/components/optolink/optolink.cpp +++ b/esphome/components/optolink/optolink.cpp @@ -1,6 +1,7 @@ #ifdef USE_ARDUINO #include "esphome/core/defines.h" +#include "esphome/core/log.h" #include "optolink.h" #include "VitoWiFi.h" diff --git a/esphome/components/optolink/optolink.h b/esphome/components/optolink/optolink.h index b7aaefab7c..3eba197d3c 100644 --- a/esphome/components/optolink/optolink.h +++ b/esphome/components/optolink/optolink.h @@ -3,8 +3,6 @@ #ifdef USE_ARDUINO #include "esphome/core/component.h" -#include "esphome/components/sensor/sensor.h" -#include "esphome/components/binary_sensor/binary_sensor.h" #include "esphome/components/text_sensor/text_sensor.h" #include "VitoWiFi.h" diff --git a/esphome/components/optolink/select/__init__.py b/esphome/components/optolink/select/__init__.py index c959b4e5bd..18333865f4 100644 --- a/esphome/components/optolink/select/__init__.py +++ b/esphome/components/optolink/select/__init__.py @@ -11,6 +11,10 @@ from esphome.const import ( ) from .. import optolink_ns, CONF_OPTOLINK_ID, SENSOR_BASE_SCHEMA +DEPENDENCIES = ["optolink"] +CODEOWNERS = ["@j0ta29"] + + OptolinkSelect = optolink_ns.class_( "OptolinkSelect", select.Select, cg.PollingComponent ) diff --git a/esphome/components/optolink/sensor/__init__.py b/esphome/components/optolink/sensor/__init__.py index 360ecaf385..c159d5e432 100644 --- a/esphome/components/optolink/sensor/__init__.py +++ b/esphome/components/optolink/sensor/__init__.py @@ -9,6 +9,10 @@ from esphome.const import ( ) from .. import CONF_OPTOLINK_ID, SENSOR_BASE_SCHEMA, optolink_ns +DEPENDENCIES = ["optolink"] +CODEOWNERS = ["@j0ta29"] + + OptolinkSensor = optolink_ns.class_( "OptolinkSensor", sensor.Sensor, cg.PollingComponent ) diff --git a/esphome/components/optolink/switch/__init__.py b/esphome/components/optolink/switch/__init__.py index 464e9feea3..7fabb71470 100644 --- a/esphome/components/optolink/switch/__init__.py +++ b/esphome/components/optolink/switch/__init__.py @@ -5,6 +5,10 @@ from esphome.components import switch from esphome.const import CONF_ADDRESS, CONF_ID, CONF_UPDATE_INTERVAL from .. import OptolinkComponent, optolink_ns +DEPENDENCIES = ["optolink"] +CODEOWNERS = ["@j0ta29"] + + OptolinkSwitch = optolink_ns.class_( "OptolinkSwitch", switch.Switch, cg.PollingComponent ) diff --git a/esphome/components/optolink/text_sensor/__init__.py b/esphome/components/optolink/text_sensor/__init__.py index 31556adb37..fe1db8e852 100644 --- a/esphome/components/optolink/text_sensor/__init__.py +++ b/esphome/components/optolink/text_sensor/__init__.py @@ -11,7 +11,8 @@ from esphome.const import ( ) from .. import optolink_ns, CONF_OPTOLINK_ID, SENSOR_BASE_SCHEMA -DEPENDENCIES = ["api"] +DEPENDENCIES = ["optolink", "api"] +CODEOWNERS = ["@j0ta29"] TextSensorMode = optolink_ns.enum("TextSensorMode") MODE = {