From f94cf1d724ab2cde6ad858c08f17c64f3fe72a7f Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 7 Jun 2023 11:08:13 -0500 Subject: [PATCH] binary sensor --- components/ratgdo/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/ratgdo/__init__.py b/components/ratgdo/__init__.py index 2e27494..3ddc120 100644 --- a/components/ratgdo/__init__.py +++ b/components/ratgdo/__init__.py @@ -36,7 +36,7 @@ CONF_STATUS_OBST = "status_obst_pin" DEFAULT_STATUS_OBST = ( 15 # D8 output for obstruction status, HIGH for obstructed, LOW for clear ) - +CONF_RATGDO_ID = "ratgdo_id" CONFIG_SCHEMA = ( cv.Schema( @@ -72,9 +72,14 @@ CONFIG_SCHEMA = ( .extend(uart.UART_DEVICE_SCHEMA) ) +RATGDO_CLIENT_SCHMEA = cv.Schema( + { + cv.Required(CONF_RATGDO_ID): cv.use_id(RATGDO), + } +) async def register_ratgdo_child(var, config): - parent = cv.use_id(RATGDO) + parent = await cg.get_variable(config[CONF_RATGDO_ID]) cg.add(parent.register_child(var))