fix call add peer action

This commit is contained in:
NP v/d Spek 2024-11-18 01:01:15 +01:00
parent ea814e3c63
commit 16586ae50d
2 changed files with 18 additions and 10 deletions

View file

@ -280,6 +280,7 @@ async def send_action(config, action_id, template_arg, args):
)
async def add_del_peer_action(config, action_id, template_arg, args):
var = cg.new_Pvariable(action_id, template_arg)
await cg.register_parented(var, config[CONF_ID])
template_ = await cg.templatable(config[CONF_PEER], args, cg.uint64)
cg.add(var.set_peer(template_))
return var

View file

@ -28,11 +28,10 @@ logger:
level: verbose
espnow:
auto_add_peer: true
auto_add_peer: false
peers:
- FF:FF:FF:FF:FF:FF
- 0xFFFFFFFFFFFF
- ZZZZZZZZ
# - kGf7Ii0t
on_receive:
- logger.log:
format: "Received: '%s' from '%s' command: %d RSSI: %d"
@ -49,20 +48,28 @@ espnow:
then:
- logger.log:
format: "Broadcast Received from: '%s' RSSI: %d: %s"
args: [packet.get_peer_code().c_str(), packet.rssi, packet.get_payload()]
args:
[
packet.get_peer_code().c_str(),
packet.rssi,
packet.get_payload(),
]
interval:
- interval: 10sec
- interval: 30sec
startup_delay: 20sec
then:
- espnow.broatcast:
payload: "hallo everyone"
command: 123
- espnow.peer.new:
peer: kGf7Ii0t
- interval: 5sec
then:
- espnow.send:
peer: kGf7Ii0t
payload: "tesing the test"
binary_sensor:
- platform: gpio
pin: GPIO39
name: Button
on_click:
- espnow.peer.new:
peer: kGf7Ii0t
- espnow.peer.del: kGf7Ii0t