1
0
mirror of https://github.com/esphome/esphome.git synced 2025-02-01 02:31:00 +00:00
2024-11-25 03:31:34 +01:00

70 lines
1.7 KiB
YAML

globals:
- id: hub_address
type: uint64_t
initial_value: "0xE86BEA23CD98"
restore_value: yes
espnow:
auto_add_peer: true
predefined_peers:
- FF:FF:FF:FF:FF:FF
- peer_id: keeper
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: keeper
payload: "hallo everyone"
command: 230
- espnow.send:
mac_address: 44:55:66:77:88:33
payload: "hallo everyone"
command: 230
- espnow.send:
# dynamic peer address
mac_address: !lambda return keeper;
payload: "use keeper dynamicly "
command: 62
- espnow.send:
mac_address: !lambda return id(hub_address);
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