BLE MESH SENSOR MODEL - How to send/get data from 2 or more server-nodes?

txrossi
Posts: 3
Joined: Tue Oct 29, 2019 6:06 pm

BLE MESH SENSOR MODEL - How to send/get data from 2 or more server-nodes?

Postby txrossi » Wed May 13, 2020 6:55 pm

Running this example : https://github.com/espressif/esp-idf/tr ... nsor_model

I'm trying to get data from 2 or more server-nodes, but I got it just from the last node connected. And I got the 2 followings "warnings" in terminal when the second node was been connected.

Code: Select all

␛[0;33mW (13345) BLE_MESH: Device already exists in queue␛[0m

and

␛[0;33mW (16875) BLE_MESH: Duplicate found in Network Message Cache␛[0m
I has changed the uuid from the servers, but when I do this, the node can't connect.

kairui
Posts: 20
Joined: Sat Feb 08, 2020 3:41 pm

Re: BLE MESH SENSOR MODEL - How to send/get data from 2 or more server-nodes?

Postby kairui » Wed Jul 22, 2020 2:25 am

I also tested the example: only surport a client and a server. when power on the secend server node, the first one will disconnected with log:

Code: Select all

BLE_MESH: No matching TX context for ack
idf version:V4.1

abansal22
Posts: 105
Joined: Wed Apr 22, 2020 8:24 am

Re: BLE MESH SENSOR MODEL - How to send/get data from 2 or more server-nodes?

Postby abansal22 » Tue Aug 25, 2020 10:38 am

Hello,

Suppose you have the 2 sensor server named as the s1 and s2, and one client model named as c1. now you successfully tested the functionality between s1 and c1, and s2 and c1. now you want to get the data from the s1 and s2 simultaneously, and show on the screen. For this you have to make the subscriber publisher model of the ble mesh. For this make a publishing group with address 0xC000 ( you can choose any one ). Now set the publishing address of the sensor cilent model to 0xC000. Similarly set the subscribing address of the sensor server models s1 and s2 to the 0xC000. Now the callback you will received data with event in the sensor client callback function will be in "ESP_BLE_MESH_SENSOR_CLIENT_PUBLISH_EVT". You have to parse the data as you are doing in the "ESP_BLE_MESH_SENSOR_CLIENT_GET_STATE_EVT".

The trickiest part is to send the message to the address 0xC000. You have 2 options one is hard code this into the code. While sending the message just swap this with the unicast address. If you donot want to hard code it, then just assign an unsigned 16 bit variable for the publishing address, lets say the variable is pubadd. Now, when setting the publishing address in sensor client model, you will receive the event in the configuration server call back event and the event name is "ESP_BLE_MESH_MODEL_OP_MODEL_PUB_SET". In that event just do this pubadd= param->value.state_change.mod_pub_set.pub_addr; this will setup the publication address into the variable and you are good to go to send the message.

Please let me know if you need anything to clear it up. also I donot frequently check into the esp32 forum site so my replies will be late!

ask1432
Posts: 5
Joined: Mon Apr 19, 2021 11:39 am
Contact:

Re: BLE MESH SENSOR MODEL - How to send/get data from 2 or more server-nodes?

Postby ask1432 » Tue Jun 22, 2021 10:24 am

please elaborate on how to make the subscriber publisher model of the ble mesh. can you send a sample code I am not able to get data from multiple nodes

jadeco
Posts: 2
Joined: Wed Mar 06, 2024 1:55 pm

Re: BLE MESH SENSOR MODEL - How to send/get data from 2 or more server-nodes?

Postby jadeco » Wed Mar 06, 2024 2:16 pm

I am also interested in how to implement it. Can you please share some code?

Who is online

Users browsing this forum: No registered users and 142 guests