esphome-ratgdo/components/ratgdo/__init__.py

34 lines
986 B
Python
Raw Normal View History

2023-06-05 17:27:06 +00:00
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.const import CONF_ID
DEPENDENCIES = ["preferences"]
ratgdo_ns = cg.esphome_ns.namespace("ratgdo")
RATGDO = ratgdo_ns.class_("RATGDO", cg.Component)
CONF_ROLLING_CODES = "rolling_codes"
CONFIG_SCHEMA = cv.Schema(
{
cv.GenerateID(): cv.declare_id(RATGDO),
2023-06-05 17:27:27 +00:00
cv.Optional(CONF_ROLLING_CODES, default=True): cv.boolean,
2023-06-05 17:27:06 +00:00
}
).extend(cv.COMPONENT_SCHEMA)
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
await cg.register_component(var, config)
2023-06-05 18:27:40 +00:00
cg.add(var.set_rolling_codes(config[CONF_ROLLING_CODES]))
2023-06-05 17:50:25 +00:00
cg.add_library(
name="secplus",
repository="https://github.com/bdraco/secplus",
version="f98c3220356c27717a25102c0b35815ebbd26ccc",
2023-06-05 17:52:42 +00:00
)
cg.add_library(
name="espsoftwareserial",
repository="https://github.com/bdraco/espsoftwareserial",
version="2f408224633316b997f82339e5b2731b1e561060",
2023-06-05 17:50:25 +00:00
)