[udp] Fix on_receive only processing first automation (#15538)

This commit is contained in:
Jonathan Swoboda
2026-04-07 17:56:01 -04:00
committed by GitHub
parent e7ddc6f6d3
commit 97ad5ab35f
+4 -6
View File
@@ -130,12 +130,9 @@ async def to_code(config):
if (listen_address := str(config[CONF_LISTEN_ADDRESS])) != "255.255.255.255":
cg.add(var.set_listen_address(listen_address))
cg.add(var.set_addresses([str(addr) for addr in config[CONF_ADDRESSES]]))
if on_receive := config.get(CONF_ON_RECEIVE):
on_receive = on_receive[0]
trigger_id = cg.new_Pvariable(on_receive[CONF_TRIGGER_ID])
trigger = await automation.build_automation(
trigger_id, trigger_argtype, on_receive
)
for conf in config.get(CONF_ON_RECEIVE, []):
trigger_id = cg.new_Pvariable(conf[CONF_TRIGGER_ID])
trigger = await automation.build_automation(trigger_id, trigger_argtype, conf)
trigger_lambda = await cg.process_lambda(
trigger.trigger(
cg.std_vector.template(cg.uint8)(
@@ -146,6 +143,7 @@ async def to_code(config):
listener_argtype,
)
cg.add(var.add_listener(trigger_lambda))
if config.get(CONF_ON_RECEIVE):
cg.add(var.set_should_listen())