mirror of
https://github.com/esphome/esphome.git
synced 2024-12-27 07:51:43 +01:00
fix triggers
This commit is contained in:
parent
167dcef1e6
commit
b6f53a6dba
1 changed files with 6 additions and 9 deletions
|
@ -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(
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue