cleanups
This commit is contained in:
parent
c27337b8b0
commit
4f9bfae7b0
|
@ -78,6 +78,7 @@ RATGDO_CLIENT_SCHMEA = cv.Schema(
|
|||
}
|
||||
)
|
||||
|
||||
|
||||
async def register_ratgdo_child(var, config):
|
||||
parent = await cg.get_variable(config[CONF_RATGDO_ID])
|
||||
cg.add(parent.register_child(var))
|
||||
|
|
|
@ -2,11 +2,7 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.components import binary_sensor
|
||||
from .. import (
|
||||
ratgdo_ns,
|
||||
register_ratgdo_child,
|
||||
RATGDO_CLIENT_SCHMEA
|
||||
)
|
||||
from .. import ratgdo_ns, register_ratgdo_child, RATGDO_CLIENT_SCHMEA
|
||||
|
||||
DEPENDENCIES = ["ratgdo"]
|
||||
|
||||
|
@ -22,11 +18,15 @@ TYPES = {
|
|||
}
|
||||
|
||||
|
||||
CONFIG_SCHEMA = binary_sensor.binary_sensor_schema(RATGDOBinarySensor).extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
}
|
||||
).extend(RATGDO_CLIENT_SCHMEA)
|
||||
CONFIG_SCHEMA = (
|
||||
binary_sensor.binary_sensor_schema(RATGDOBinarySensor)
|
||||
.extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
}
|
||||
)
|
||||
.extend(RATGDO_CLIENT_SCHMEA)
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
|
@ -2,17 +2,11 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.components import button
|
||||
from .. import (
|
||||
ratgdo_ns,
|
||||
register_ratgdo_child,
|
||||
RATGDO_CLIENT_SCHMEA
|
||||
)
|
||||
from .. import ratgdo_ns, register_ratgdo_child, RATGDO_CLIENT_SCHMEA
|
||||
|
||||
DEPENDENCIES = ["ratgdo"]
|
||||
|
||||
RATGDOButton = ratgdo_ns.class_(
|
||||
"RATGDOButton", button.Button, cg.Component
|
||||
)
|
||||
RATGDOButton = ratgdo_ns.class_("RATGDOButton", button.Button, cg.Component)
|
||||
ButtonType = ratgdo_ns.enum("ButtonType")
|
||||
|
||||
CONF_TYPE = "type"
|
||||
|
@ -21,11 +15,15 @@ TYPES = {
|
|||
}
|
||||
|
||||
|
||||
CONFIG_SCHEMA = button.button_schema(RATGDOButton).extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
}
|
||||
).extend(RATGDO_CLIENT_SCHMEA)
|
||||
CONFIG_SCHEMA = (
|
||||
button.button_schema(RATGDOButton)
|
||||
.extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
}
|
||||
)
|
||||
.extend(RATGDO_CLIENT_SCHMEA)
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
|
@ -3,20 +3,16 @@ from esphome.const import CONF_ID
|
|||
import esphome.config_validation as cv
|
||||
|
||||
from esphome.components import cover
|
||||
from .. import (
|
||||
ratgdo_ns,
|
||||
register_ratgdo_child,
|
||||
RATGDO_CLIENT_SCHMEA
|
||||
)
|
||||
from .. import ratgdo_ns, register_ratgdo_child, RATGDO_CLIENT_SCHMEA
|
||||
|
||||
DEPENDENCIES = ["ratgdo"]
|
||||
|
||||
RATGDOCover = ratgdo_ns.class_(
|
||||
"RATGDOCover", cover.Cover, cg.Component
|
||||
)
|
||||
RATGDOCover = ratgdo_ns.class_("RATGDOCover", cover.Cover, cg.Component)
|
||||
|
||||
|
||||
CONFIG_SCHEMA = cover.COVER_SCHEMA.extend({cv.GenerateID(): cv.declare_id(RATGDOCover)}).extend(RATGDO_CLIENT_SCHMEA)
|
||||
CONFIG_SCHEMA = cover.COVER_SCHEMA.extend(
|
||||
{cv.GenerateID(): cv.declare_id(RATGDOCover)}
|
||||
).extend(RATGDO_CLIENT_SCHMEA)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_OUTPUT_ID, # New in 2023.5
|
||||
CONF_OUTPUT_ID, # New in 2023.5
|
||||
)
|
||||
from esphome.components import light
|
||||
from .. import (
|
||||
ratgdo_ns,
|
||||
register_ratgdo_child,
|
||||
RATGDO_CLIENT_SCHMEA
|
||||
)
|
||||
from .. import ratgdo_ns, register_ratgdo_child, RATGDO_CLIENT_SCHMEA
|
||||
|
||||
DEPENDENCIES = ["ratgdo"]
|
||||
|
||||
|
@ -17,7 +13,9 @@ RATGDOLightOutput = ratgdo_ns.class_(
|
|||
)
|
||||
|
||||
|
||||
CONFIG_SCHEMA = light.LIGHT_SCHEMA.extend({cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(RATGDOLightOutput)}).extend(RATGDO_CLIENT_SCHMEA)
|
||||
CONFIG_SCHEMA = light.LIGHT_SCHEMA.extend(
|
||||
{cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(RATGDOLightOutput)}
|
||||
).extend(RATGDO_CLIENT_SCHMEA)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
|
@ -2,17 +2,11 @@ import esphome.codegen as cg
|
|||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID
|
||||
from esphome.components import number
|
||||
from .. import (
|
||||
ratgdo_ns,
|
||||
register_ratgdo_child,
|
||||
RATGDO_CLIENT_SCHMEA
|
||||
)
|
||||
from .. import ratgdo_ns, register_ratgdo_child, RATGDO_CLIENT_SCHMEA
|
||||
|
||||
DEPENDENCIES = ["ratgdo"]
|
||||
|
||||
RATGDONumber = ratgdo_ns.class_(
|
||||
"RATGDONumber", number.Number, cg.Component
|
||||
)
|
||||
RATGDONumber = ratgdo_ns.class_("RATGDONumber", number.Number, cg.Component)
|
||||
NumberType = ratgdo_ns.enum("NumberType")
|
||||
|
||||
CONF_TYPE = "type"
|
||||
|
@ -21,11 +15,15 @@ TYPES = {
|
|||
}
|
||||
|
||||
|
||||
CONFIG_SCHEMA = number.number_schema(RATGDONumber).extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
}
|
||||
).extend(RATGDO_CLIENT_SCHMEA)
|
||||
CONFIG_SCHEMA = (
|
||||
number.number_schema(RATGDONumber)
|
||||
.extend(
|
||||
{
|
||||
cv.Required(CONF_TYPE): cv.enum(TYPES, lower=True),
|
||||
}
|
||||
)
|
||||
.extend(RATGDO_CLIENT_SCHMEA)
|
||||
)
|
||||
|
||||
|
||||
async def to_code(config):
|
||||
|
|
Loading…
Reference in New Issue