1
0
mirror of https://github.com/esphome/esphome.git synced 2025-01-31 18:20:53 +00:00
2024-12-05 18:38:36 +01:00

62 lines
1.4 KiB
YAML

globals:
- id: keeper
type: uint64_t
initial_value: "0xE86BEA23CD98"
restore_value: yes
espnow:
auto_add_peer: true
wifi_channel: 1
predefined_peers:
- FF:FF:FF:FF:FF:FF
- mac_address: 11:22:33:44:55:66
wifi_channel: 2
on_receive:
- logger.log:
format: "Received: '%s' from '%s' command: %d RSSI: %d"
args:
[
packet.get_payload(),
packet.get_peer_code().c_str(),
packet.get_command(),
packet.rssi,
]
on_broadcast:
- command: 123
then:
- logger.log:
format: "Broadcast Received from: '%s' RSSI: %d: %s"
args:
[
packet.get_peer_code().c_str(),
packet.rssi,
packet.get_payload(),
]
interval:
- interval: 10sec
then:
- espnow.broadcast:
payload: "hallo everyone"
command: 123
- espnow.send:
mac_address: 44:55:66:77:88:33
payload: "hallo everyone"
command: 230
- espnow.send:
mac_address: !lambda return id(keeper);
payload: "Using a global numberic value dynamicly"
command: 132
binary_sensor:
- platform: gpio
pin: GPIO39
name: Button
on_click:
- espnow.peer.add:
mac_address: 22:44:66:88:AA:CC
wifi_channel: 3
- espnow.peer.del: 22:44:66:88:AA:CC