remote_receiver: use config parent receiver for registering dumpers (#1980)

This commit is contained in:
Jesse Hills 2021-07-06 10:15:29 +12:00 committed by GitHub
parent 79b9d0579d
commit 062cedc200
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -176,7 +176,9 @@ validate_binary_sensor = cv.validate_registry_entry(
TRIGGER_REGISTRY = SimpleRegistry()
DUMPER_REGISTRY = Registry(
{
cv.GenerateID(CONF_RECEIVER_ID): cv.use_id(RemoteReceiverBase),
cv.Optional(CONF_RECEIVER_ID): cv.invalid(
"This has been removed in ESPHome 1.20.0 and the dumper attaches directly to the parent receiver."
),
}
)
@ -228,8 +230,6 @@ async def build_dumpers(config):
dumpers = []
for conf in config:
dumper = await cg.build_registry_entry(DUMPER_REGISTRY, conf)
receiver = await cg.get_variable(conf[CONF_RECEIVER_ID])
cg.add(receiver.register_dumper(dumper))
dumpers.append(dumper)
return dumpers

View File

@ -54,7 +54,10 @@ async def to_code(config):
else:
var = cg.new_Pvariable(config[CONF_ID], pin)
await remote_base.build_dumpers(config[CONF_DUMP])
dumpers = await remote_base.build_dumpers(config[CONF_DUMP])
for dumper in dumpers:
cg.add(var.register_dumper(dumper))
await remote_base.build_triggers(config)
await cg.register_component(var, config)