From b6f53a6dba9cae02ac68472ca91242bda5ffae40 Mon Sep 17 00:00:00 2001 From: NP v/d Spek Date: Tue, 24 Sep 2024 17:06:48 +0200 Subject: [PATCH] fix triggers --- esphome/components/espnow/__init__.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/esphome/components/espnow/__init__.py b/esphome/components/espnow/__init__.py index cba098d24e..4b99a8c7c2 100644 --- a/esphome/components/espnow/__init__.py +++ b/esphome/components/espnow/__init__.py @@ -11,6 +11,7 @@ ESPNowComponent = espnow_ns.class_("ESPNowComponent", cg.Component) ESPNowListener = espnow_ns.class_("ESPNowListener") ESPNowPacket = espnow_ns.class_("ESPNowPacket") +ESPNowPacketPtr = ESPNowPacket.operator("ptr") ESPNowInterface = espnow_ns.class_( @@ -93,21 +94,17 @@ async def to_code(config): trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) await automation.build_automation( trigger, - [(cg.std_shared_ptr.template(ESPNowPacket), "packet"), (bool, "status")], + [(ESPNowPacketPtr, "packet"), (bool, "status")], conf, ) for conf in config.get(CONF_ON_RECEIVE, []): trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) - await automation.build_automation( - trigger, [(cg.std_shared_ptr.template(ESPNowPacket), "packet")], conf - ) + await automation.build_automation(trigger, [(ESPNowPacketPtr, "packet")], conf) for conf in config.get(CONF_ON_NEW_PEER, []): trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var) - await automation.build_automation( - trigger, [(cg.std_shared_ptr.template(ESPNowPacket), "packet")], conf - ) + await automation.build_automation(trigger, [(ESPNowPacketPtr, "packet")], conf) for conf in config.get(CONF_PEERS, []): cg.add(var.add_peer(conf.as_hex)) @@ -160,7 +157,7 @@ async def send_action(config, action_id, template_arg, args): @automation.register_action( - "espnow.new.peer", + "espnow.peer.new", NewPeerAction, cv.maybe_simple_value( { @@ -178,7 +175,7 @@ async def new_peer_action(config, action_id, template_arg, args): @automation.register_action( - "espnow.del.peer", + "espnow.peer.del", DelPeerAction, cv.maybe_simple_value( {