From bf2a7939840f335687136225575a48351bab2573 Mon Sep 17 00:00:00 2001 From: Chelios Date: Tue, 17 Sep 2024 10:05:37 +0300 Subject: [PATCH] fix CONFIG_SCHEMA in init modem --- esphome/components/modem/__init__.py | 54 ++++++++++++++++------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/esphome/components/modem/__init__.py b/esphome/components/modem/__init__.py index dc8e9c2f96..24520a8dd6 100644 --- a/esphome/components/modem/__init__.py +++ b/esphome/components/modem/__init__.py @@ -78,30 +78,38 @@ def _validate(config): config[CONF_USE_ADDRESS] = use_address return config +CONFIG_SCHEMA = cv.Schema( + { + cv.GenerateID(): cv.declare_id(ModemComponent), + cv.Required(CONF_TYPE): cv.enum(MODEM_TYPES, upper=True), + cv.Optional(CONF_DOMAIN, default=".local"): cv.domain_name, + cv.Optional(CONF_USE_ADDRESS): cv.string_strict, + } +).extend(cv.COMPONENT_SCHEMA) -CONFIG_SCHEMA = cv.All( - cv.Schema( - { - cv.GenerateID(): cv.declare_id(ModemComponent), - cv.Required(CONF_TYPE): cv.enum(MODEM_TYPES, upper=True), - #cv.Required(CONF_MDC_PIN): pins.internal_gpio_output_pin_number, - # cv.Required(CONF_MDIO_PIN): pins.internal_gpio_output_pin_number, - # cv.Optional(CONF_CLK_MODE, default="GPIO0_IN"): cv.enum( - # CLK_MODES, upper=True, space="_" - # ), - # cv.Optional(CONF_PHY_ADDR, default=0): cv.int_range(min=0, max=31), - # cv.Optional(CONF_POWER_PIN): pins.internal_gpio_output_pin_number, - # cv.Optional(CONF_MANUAL_IP): MANUAL_IP_SCHEMA, - cv.Optional(CONF_DOMAIN, default=".local"): cv.domain_name, - cv.Optional(CONF_USE_ADDRESS): cv.string_strict, - # cv.Optional("enable_mdns"): cv.invalid( - # "This option has been removed. Please use the [disabled] option under the " - # "new mdns component instead." - # ), - } - ).extend(cv.COMPONENT_SCHEMA), - _validate, -) +# cv.All( +# cv.Schema( +# { +# cv.GenerateID(): cv.declare_id(ModemComponent), +# cv.Required(CONF_TYPE): cv.enum(MODEM_TYPES, upper=True), +# #cv.Required(CONF_MDC_PIN): pins.internal_gpio_output_pin_number, +# # cv.Required(CONF_MDIO_PIN): pins.internal_gpio_output_pin_number, +# # cv.Optional(CONF_CLK_MODE, default="GPIO0_IN"): cv.enum( +# # CLK_MODES, upper=True, space="_" +# # ), +# # cv.Optional(CONF_PHY_ADDR, default=0): cv.int_range(min=0, max=31), +# # cv.Optional(CONF_POWER_PIN): pins.internal_gpio_output_pin_number, +# # cv.Optional(CONF_MANUAL_IP): MANUAL_IP_SCHEMA, +# cv.Optional(CONF_DOMAIN, default=".local"): cv.domain_name, +# cv.Optional(CONF_USE_ADDRESS): cv.string_strict, +# # cv.Optional("enable_mdns"): cv.invalid( +# # "This option has been removed. Please use the [disabled] option under the " +# # "new mdns component instead." +# # ), +# } +# ).extend(cv.COMPONENT_SCHEMA), +# _validate, +# ) # def manual_ip(config):