esphome-ratgdo/components/ratgdo/light/__init__.py

25 lines
719 B
Python
Raw Permalink Normal View History

2023-06-07 18:27:01 +00:00
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import light
2023-06-09 20:54:28 +00:00
from esphome.const import CONF_OUTPUT_ID # New in 2023.5
from .. import RATGDO_CLIENT_SCHMEA, ratgdo_ns, register_ratgdo_child
2023-06-07 18:27:01 +00:00
DEPENDENCIES = ["ratgdo"]
RATGDOLightOutput = ratgdo_ns.class_(
"RATGDOLightOutput", light.LightOutput, cg.Component
)
2023-06-07 23:49:13 +00:00
CONFIG_SCHEMA = light.LIGHT_SCHEMA.extend(
{cv.GenerateID(CONF_OUTPUT_ID): cv.declare_id(RATGDOLightOutput)}
).extend(RATGDO_CLIENT_SCHMEA)
2023-06-07 18:27:01 +00:00
async def to_code(config):
var = cg.new_Pvariable(config[CONF_OUTPUT_ID])
await cg.register_component(var, config)
await light.register_light(var, config)
await register_ratgdo_child(var, config)