Github Devices Community Docs Blog

BLE Gateway on ESP32

Hi I have successfully compiled and uploaded the BLE Gateway to my ESP 32 and it works as expected. Platform IO Arduino environment.
However I have two issues, one is that I can not access the web interface anymore after I configured the unit to connect to my WiFi AP. It is configured DHCP and it receives an address and I can ping it. It also delivers the beacon reads to the MQTT topic as expected.

Secondly it looks like the gateway it is not accepting ( subscribing) the MQTT topic to change its scan settings e.g. if I want to change from the default 66 sec for the scan interval to 10 sec.

Thanks in advance for your help

Hello,

This is the current behaviour. If you want to reconfigure you can press the TRIGGER_PIN for more than 10s to reset settings.

Could you give the commands that you are sending by mqtt?

Thank you very much for your prompt response and your much appreciated help.

This is the command I issue from a local (layer 2) connected PC

mosquitto_pub -h 10.10.10.13 -t home/OpenMQTTGateway/commands/MQTTtoBT/set -m ‘{“interval”:0}’

Monitoring the MQTT server locally shows on the console

home/OpenMQTTGateway/commands/MQTTtoBT/set {“interval”:0}

I have tried to run the command local with the same result.

Thanks, could you give also the version of OMG used ?
Would it be possible to have a serial monitor extract when you process the command ?

Hi, thanks for your help. I think I now understand what is happening.
I’m running v0.9.2/ESP32_OpenMQTTGateway_V092_BLE

When I issue the MQTT command and the ESP receives it from the topic as expected.

Console output = BT Task running on core 0
Then the the program listen for about ~40 seconds for advertisements.

In my case I have beacon which advertise every second, I expected the result as soon as one of the beacon chirped, that is obviously not the case! and not needed for this application.

I will look into the code and see if I can modify it, I’m after a BLE scanner which immediately reports a chirp, I’m using this only for location tracking.

I would like to take this opportunity to thank you and all the contributors for this outstanding project, well done!

As a suggestion, I would like to buy you guys a Tea but I’m not so keen to use my credit card, any way I can make a donation via PayPal?

Cheers

Hello,

Do you get this log in the serial monitor :

"BLE interval set"

If not there is a problem somewhere.

Thanks for the feedback.

Yes I will send you an email adress.

Hi I monitored the serial output and after issuing:
mosquitto_pub -h 10.10.10.13 -t home/OpenMQTTGateway/commands/MQTTtoBT/set -m ‘{“interval”:0}’
I don’t see any "BLE interval set"

I see the received message on the MQTT server arriving when monitoring the MQTT broker.
home/OpenMQTTGateway/commands/MQTTtoBT/set {“interval”:0}

However the serial out put shows nothing at that time. Below this output which shows after (in this case) 20 seconds, when I issued the MQTT command to set the interval to 0.
It would led to believe that the MQTT command is not picked up by the ESP. Could this be a timing issue?

Thanks again for all your help.

From what I can see it processes its normal loop and the MQTT input is not changing its behavior.
10:49:57.950 -> Creating BLE buffer
10:49:57.950 -> device detected
10:49:57.950 -> xx:xx:xx:xx
10:49:57.950 -> BLErssi
10:49:57.950 -> -61
10:49:57.950 -> txPower
10:49:57.950 -> -59
10:49:57.950 -> BLE DISTANCE :
10:49:57.950 -> 1.27
10:49:57.950 -> Pub json into:
10:49:57.950 -> home/home_presence/OpenMQTTGateway_ESP32_BLE
10:49:57.950 -> {“id”:“xx:xx:xx:xx:xx:xx”,“name”:“OnyxBeacon”,“manufacturerdata”:“L”,“rssi”:-61,“distance”:1.274439}
10:49:57.983 -> Pub data per topic
10:49:57.983 -> id
10:49:57.983 -> xx:xx:xx:xx
10:49:57.983 -> name
10:49:57.983 -> OnyxBeacon
10:49:57.983 -> manufacturerdata
10:49:57.983 -> L
10:49:57.983 -> rssi
10:49:57.983 -> -61
10:49:57.983 -> distance
10:49:57.983 -> 1.27
10:49:57.983 -> Get services data :
10:49:57.983 -> 1
10:49:57.983 -> Pub json into:
10:49:57.983 -> home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/xx:xx:xx:xx
10:49:57.983 -> {“id”:“xx:xx:xx:xx”,“name”:“OnyxBeacon”,“manufacturerdata”:“L”,“rssi”:-61,“distance”:1.274439,“servicedata”:“xx:xx:xx:xx”,“servicedatauuid”:“xx:xx:xx:xxxx:xx:xx:xxxx:xx:xx:xx”}
10:49:58.598 -> Pub data per topic
10:49:58.598 -> id
10:49:58.598 -> xx:xx:xx:xx
10:49:58.598 -> name
10:49:58.598 -> OnyxBeacon
10:49:58.598 -> manufacturerdata
10:49:58.598 -> L
10:49:58.598 -> rssi
10:49:58.598 -> -61
10:49:58.598 -> distance
10:49:58.598 -> 1.27
10:49:58.598 -> servicedata
10:49:58.598 -> xx:xx:xx:xx
10:49:58.598 -> servicedatauuid
10:49:58.598 -> xx:xx:xx:xx
10:50:07.738 -> BT Task running on core 0

This is due to the fact that the command doesn’t correspond to your gateway_name,

you should try:
mosquitto_pub -h 10.10.10.13 -t home/OpenMQTTGateway_ESP32_BLE/commands/MQTTtoBT/set -m ‘{"interval":0}’