Page 1 of 1

ESP32 Mesh Mlink protocol

Posted: Wed Sep 11, 2019 3:13 pm
by koksing1
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.

Re: ESP32 Mesh Mlink protocol

Posted: Tue Sep 17, 2019 9:33 am
by ESP_Bond
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"
}

Re: ESP32 Mesh Mlink protocol

Posted: Wed Sep 18, 2019 8:54 am
by fasani
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

Re: ESP32 Mesh Mlink protocol

Posted: Fri Sep 20, 2019 4:17 pm
by koksing1
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.

Re: ESP32 Mesh Mlink protocol

Posted: Thu Oct 10, 2019 12:01 pm
by ESP_Bond
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`