ESP32 Mesh Mlink protocol

koksing1
Posts: 2
Joined: Wed Sep 11, 2019 2:56 pm

ESP32 Mesh Mlink protocol

Postby koksing1 » Wed Sep 11, 2019 3:13 pm

Hi

Refer to the doc https://docs.espressif.com/projects/esp ... mlink.html
How to get the following result and receive broadcast while the light is turn on/off?

2. Receiving Broadcast UDP Packets
When scanning for devices, the app broadcasts UDP packets and obtains the information about the root node from its reply.

Request:

"Are You Espressif IOT Smart Device?"
Response:

"ESP32 Mesh 112233445566 http 80"

3.5. Device Status Notification
When the status of the ESP-MDF device (on/off), network connection (connected or disconnected), and route table change, the root node will send broadcast UDP packets to notify the app to obtain the latest status of the device.

UDP Broadcast:

mac=112233445566 flag=1234 type=***
mac is the MAC address of the device whose status has changed;
flag is a random integer value used to distinguish among notifications at different times;
type is the type of change, including:
status indicates that the device status has changed;
https indicates that the information of the device connection in the network has changed, and the updated information is required through https communication protocol;
http indicates that the information of the device connection in the network has changed, and the updated information is required through http communication protocol;
sniffer indicates that a new networked device has been sniffered.

ESP_Bond
Posts: 51
Joined: Mon Apr 15, 2019 1:37 pm

Re: ESP32 Mesh Mlink protocol

Postby ESP_Bond » Tue Sep 17, 2019 9:33 am

UDP and mDNS are only used for device discovery, that is, the IP address of the root node of the ESP-MESH network is obtained.
If you need to control the device you need to send an http request
Image

Code: Select all

POST /device_request HTTP/1.1
Host: 192.168.111.183:80
Content-Type: application/json
Mesh-Node-Mac: ffffffffffff
cache-control: no-cache

{
	"request": "get_device_info"
}

User avatar
fasani
Posts: 197
Joined: Wed Jan 30, 2019 12:00 pm
Location: Barcelona
Contact:

Re: ESP32 Mesh Mlink protocol

Postby fasani » Wed Sep 18, 2019 8:54 am

In this small repository there is a small example:

https://github.com/martinberlin/M5Stick ... phone-Mesh

It was supposed to be called : Microphone-Mesh and it's ready to be compiled in a M5-Stick-C

The IP of the root lamp you can get making a ping to:
http://esp32_mesh.local

From any device with Bonjour / or linux. I could not find a way to do an MDNS query to read it. Starting to learn IDF now
epdiy collaborator | http://fasani.de Fan of Espressif MCUs and electronic design

koksing1
Posts: 2
Joined: Wed Sep 11, 2019 2:56 pm

Re: ESP32 Mesh Mlink protocol

Postby koksing1 » Fri Sep 20, 2019 4:17 pm

But no answer from the official doc, list below

When the status of the ESP-MDF device (on/off), network connection (connected or disconnected), and route table change, the root node will send broadcast UDP packets to notify the app to obtain the latest status of the device.

I already know how to use http control and get the status, but the important things is how to notify the change automatically while someone turn on/off.

ESP_Bond
Posts: 51
Joined: Mon Apr 15, 2019 1:37 pm

Re: ESP32 Mesh Mlink protocol

Postby ESP_Bond » Thu Oct 10, 2019 12:01 pm

The device sends a UDP broadcast notification via `mlink_notice_write()`.
The client needs to start a udp sever to receive,
The default port for UDP broadcast is 1025, you can modify it with `make menuconfig`

Who is online

Users browsing this forum: No registered users and 57 guests