mirror of
https://github.com/esphome/esphome.git
synced 2024-12-28 00:11: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")
|
ESPNowListener = espnow_ns.class_("ESPNowListener")
|
||||||
|
|
||||||
ESPNowPacket = espnow_ns.class_("ESPNowPacket")
|
ESPNowPacket = espnow_ns.class_("ESPNowPacket")
|
||||||
|
ESPNowPacketPtr = ESPNowPacket.operator("ptr")
|
||||||
|
|
||||||
|
|
||||||
ESPNowInterface = espnow_ns.class_(
|
ESPNowInterface = espnow_ns.class_(
|
||||||
|
@ -93,21 +94,17 @@ async def to_code(config):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
await automation.build_automation(
|
await automation.build_automation(
|
||||||
trigger,
|
trigger,
|
||||||
[(cg.std_shared_ptr.template(ESPNowPacket), "packet"), (bool, "status")],
|
[(ESPNowPacketPtr, "packet"), (bool, "status")],
|
||||||
conf,
|
conf,
|
||||||
)
|
)
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_RECEIVE, []):
|
for conf in config.get(CONF_ON_RECEIVE, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
await automation.build_automation(
|
await automation.build_automation(trigger, [(ESPNowPacketPtr, "packet")], conf)
|
||||||
trigger, [(cg.std_shared_ptr.template(ESPNowPacket), "packet")], conf
|
|
||||||
)
|
|
||||||
|
|
||||||
for conf in config.get(CONF_ON_NEW_PEER, []):
|
for conf in config.get(CONF_ON_NEW_PEER, []):
|
||||||
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
trigger = cg.new_Pvariable(conf[CONF_TRIGGER_ID], var)
|
||||||
await automation.build_automation(
|
await automation.build_automation(trigger, [(ESPNowPacketPtr, "packet")], conf)
|
||||||
trigger, [(cg.std_shared_ptr.template(ESPNowPacket), "packet")], conf
|
|
||||||
)
|
|
||||||
|
|
||||||
for conf in config.get(CONF_PEERS, []):
|
for conf in config.get(CONF_PEERS, []):
|
||||||
cg.add(var.add_peer(conf.as_hex))
|
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(
|
@automation.register_action(
|
||||||
"espnow.new.peer",
|
"espnow.peer.new",
|
||||||
NewPeerAction,
|
NewPeerAction,
|
||||||
cv.maybe_simple_value(
|
cv.maybe_simple_value(
|
||||||
{
|
{
|
||||||
|
@ -178,7 +175,7 @@ async def new_peer_action(config, action_id, template_arg, args):
|
||||||
|
|
||||||
|
|
||||||
@automation.register_action(
|
@automation.register_action(
|
||||||
"espnow.del.peer",
|
"espnow.peer.del",
|
||||||
DelPeerAction,
|
DelPeerAction,
|
||||||
cv.maybe_simple_value(
|
cv.maybe_simple_value(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue