-
I’m want to scan ble devices using ESP32 and send it to the MQTT Broker. It looks like ESP32 is able to connect to the broker but sends “offline”. Serial monitor shows the scanned devices and data it is trying to send. I’m using MQTT fx tool to check the data received on all the topics using home/#. the broker only receives “offline” on home/OpenMQTTGateway/LWT every few seconds.
-
From the serial monitor logs, (at the end) it looks like the devices is reconnecting repeatedly in every loop, is it expected?
I’m using Arduino IDE and the only changes I have done are below (credentials are masked):
Logs from Serial monitor:
************* WELCOME TO OpenMQTTGateway **************
I: OpenMQTTGateway Version: version_tag
I: WiFi ok with manual config credentials
I: BLE scans interval: 55555
I: BLE scans number before connect: 10
I: Publishing only BLE sensors: false
I: minrssi: 100
I: Low Power Mode: 0
I: OpenMQTTGateway modules: ["BT"]
I: ************** Setup OpenMQTTGateway end **************
W: MQTT connection...
I: Connected to broker
I: Send on /SYStoMQTT msg {"uptime":8,"version":"version_tag","freemem":144112,"mqttport":"1883","mqttsecure":false,"freestack":6148,"rssi":-64,"SSID":"XXXX","BSSID":"XX:32:XX:59:XX:XX","ip":"192.168.1.129","mac":"84:XX:A8:7A:XX:XX","lowpowermode":0,"btqblck":0,"btqsum":0,"btqsnd":0,"btqavg":0,"interval":55555,"scanbcnct":10,"scnct":0,"modules":["BT"]}
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
I: Scan begin
I: Device detected: XX:XX:CC:XX:C5:XX
I: Send on /BTtoMQTT/XXXXXXXXXX msg {"id":"XX:56:XX:FC:XX:XX","mac_type":1,"manufacturerdata":"xxxxxxxxxxx","rssi":-91,"txpower":12}
W: Client not connected, aborting thes publication
W: MQTT connection...
I: Device detected: XX:60:XX:E9:XX:XX
I: Device detected: XX:93:F1:XX:DF:XX
I: Device detected: 2B:XX:XX:FC:XX:XX
I: Device detected: AC:XX:XX:AB:81:XX
I: Connected to broker
I: Send on /BTtoMQTT/XXXXXXXXXX msg {"id":"XX:60:XX:XX:XX:XX","mac_type":1,"manufacturerdata":"xxxxxxxxxxxxxxxx","rssi":-97,"txpower":8}
I: Device detected: D8:01:00:05:29:4A
I: Send on /BTtoMQTT/xxxxxxxxxx msg {"id":"XX:93:XX:B9:XX:XX","mac_type":1,"manufacturerdata":"xxxxxxxx","rssi":-61}
I: Device detected: XX:XX:3F:XX:81:XX
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":1,"manufacturerdata":"xxxxxxxxxxxxxx","rssi":-95}
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":0,"name":"XXXX","manufacturerdata":"xxxxxx","rssi":-86}
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":1,"rssi":-82,"servicedata":"xxxxxxxx","servicedatauuid":"xxxx"}
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":0,"manufacturerdata":"xxxxxx","rssi":-78}
I: Device detected: XX:XX:XX:XX:XX:XX
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":1,"name":"xxxx","manufacturerdata":"xxxxxx","rssi":-82}
W: MQTT connection...
I: Device detected: XX:XX:21:XX:XX:XX
I: Device detected: XX:XX:21:XX:XX:XX
I: Connected to broker
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":0,"name":"xxxx","manufacturerdata":"xxxxxx","rssi":-78}
I: Send on /BTtoMQTT/XXXXXXXXX msg {"id":"XX:XX:21:XX:XX:XX","mac_type":0,"name":"xxxx","manufacturerdata":"xxxxxx","rssi":-78}
I: Found 8 devices, scan number 1 end
I: BLE Connect begin
I: BLE Connect end
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker
W: MQTT connection...
I: Connected to broker