I am trying to make my own smart home system using esp32s. The idea is that I have 1 hub, and then have esp32-powered end devices, such as switches. These end devices will need to be low power consumption as well, so they cannot use wifi (hence why I turned to ESP-NOW). I have been trying the examples, and I can't seem to wrap my head around how this system works.
My goal is only to have the hub be able to use wifi, as it will need to talk to Alexa using ESP-RAINMAKER. I want a pairing functionality where any hub and end device can be paired if their pair buttons are held down for a few seconds in synch. Note, I'm thinking about the large scale, so devices don't know each other's MAC addresses, so they will need to discover each other somehow.
Here is my general understanding.
- Initialize esp-now
- register peer by setting channel, encryption, then a general addr to broadcast to (0xFF,0xFF,0xFF,0xFF,0xFF,0xFF)
- register a callback function for dataSend and dataReceive
- Now, when a button is pressed, use esp_now_send to send a structure of pairing data
- The hub does the same thing, and when either receives the others pairing request, it unpackages that struct and stores the devices mac address and registers it as a peer. This should mean each has the other registered as a peer now and can now sit and wait until further commands.
I would really appreciate any help in clarifying my understanding as I am new to this stuff.
Bi-Directional communication using ESP-NOW
-
- Posts: 5
- Joined: Tue Nov 28, 2023 6:13 am
Who is online
Users browsing this forum: No registered users and 44 guests