Basic ESPNow proxy component for ESPHome supporting Unicast and Broadcast.
ESPNow is a protocol that allows for direct communication between ESP32 (and ESP8266) devices without needing a WiFi router or access point. It uses the same radio chip as WiFi to establish a direct peer-to-peer connection.
This custom component for esphome supports only the sending and receiving of commands using esphome / ESP32.
There is no support for sensor data just the basic send/recv functionality using a simple data protocol with command ack.
The code is inspired by Beethowen and EasyNow: Beethowen Transmitter, Beethowen Receiver EasyNow
When SoftAP is being used, the mac address will be different. This will cause issues, when only using the base mac address.
More info:
- https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/system/misc_system_api.html
- https://forum.arduino.cc/t/question-about-mac-address-and-esp-now/1017002/5
- https://lastminuteengineers.com/esp32-mac-address-tutorial/
The unicast confiuration is being used, to only send to a specific device. This can be done by setting the mac address in receiver
.
espnow_proxy:
id: espnow_send
channel: 1
receiver: AA:BB:CC:DD:EE:FF
peers:
- mac_address: AA:BB:CC:DD:EE:FF
name_prefix: Peer1
When the receiver
is left out, broadcast address (FF:FF:FF:FF:FF:FF) will be used.
espnow_proxy:
id: espnow_send
channel: 1
peers:
- mac_address: AA:BB:CC:DD:EE:FF
name_prefix: Peer1
- mac_address: AA:BB:CC:DD:EE:FF
name_prefix: Peer2
espnow_proxy:
id: espnow_send
channel: 1
on_packet_data: # All packets
- ...
on_command_data: # command data
- ...
on_send_started: # sending starts
- ...
on_send_finished: # sending finished
- ...
on_send_failed: # sending failed
- ...
peers:
- mac_address: AA:BB:CC:DD:EE:FF
on_packet_data: # Only packets directed to this peer
- ...
on_command_data:
- ...
on_send_started:
- ...
on_send_finished:
- ...
on_send_failed: