mirror of
https://github.com/esphome/esphome.git
synced 2025-02-01 10:40:56 +00:00
fix call add peer action
This commit is contained in:
parent
ea814e3c63
commit
16586ae50d
@ -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):
|
async def add_del_peer_action(config, action_id, template_arg, args):
|
||||||
var = cg.new_Pvariable(action_id, template_arg)
|
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)
|
template_ = await cg.templatable(config[CONF_PEER], args, cg.uint64)
|
||||||
cg.add(var.set_peer(template_))
|
cg.add(var.set_peer(template_))
|
||||||
return var
|
return var
|
||||||
|
@ -28,11 +28,10 @@ logger:
|
|||||||
level: verbose
|
level: verbose
|
||||||
|
|
||||||
espnow:
|
espnow:
|
||||||
auto_add_peer: true
|
auto_add_peer: false
|
||||||
peers:
|
peers:
|
||||||
- FF:FF:FF:FF:FF:FF
|
- FF:FF:FF:FF:FF:FF
|
||||||
- 0xFFFFFFFFFFFF
|
# - kGf7Ii0t
|
||||||
- ZZZZZZZZ
|
|
||||||
on_receive:
|
on_receive:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: "Received: '%s' from '%s' command: %d RSSI: %d"
|
format: "Received: '%s' from '%s' command: %d RSSI: %d"
|
||||||
@ -49,20 +48,28 @@ espnow:
|
|||||||
then:
|
then:
|
||||||
- logger.log:
|
- logger.log:
|
||||||
format: "Broadcast Received from: '%s' RSSI: %d: %s"
|
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:
|
||||||
- interval: 10sec
|
- interval: 30sec
|
||||||
|
startup_delay: 20sec
|
||||||
then:
|
then:
|
||||||
- espnow.broatcast:
|
- espnow.peer.new:
|
||||||
payload: "hallo everyone"
|
peer: kGf7Ii0t
|
||||||
command: 123
|
- interval: 5sec
|
||||||
|
then:
|
||||||
|
- espnow.send:
|
||||||
|
peer: kGf7Ii0t
|
||||||
|
payload: "tesing the test"
|
||||||
|
|
||||||
binary_sensor:
|
binary_sensor:
|
||||||
- platform: gpio
|
- platform: gpio
|
||||||
pin: GPIO39
|
pin: GPIO39
|
||||||
name: Button
|
name: Button
|
||||||
on_click:
|
on_click:
|
||||||
- espnow.peer.new:
|
|
||||||
peer: kGf7Ii0t
|
|
||||||
- espnow.peer.del: kGf7Ii0t
|
- espnow.peer.del: kGf7Ii0t
|
||||||
|
Loading…
x
Reference in New Issue
Block a user