@@ -189,7 +189,7 @@ void DeviceManager::bleDevice_updated(const QBluetoothDeviceInfo &info, QBluetoo
189189 // MQTT send
190190 SettingsManager *sm = SettingsManager::getInstance ();
191191 MqttManager *mq = MqttManager::getInstance ();
192- if (sm && mq)
192+ if (sm && mq && !mac_qstr_clean. isEmpty () )
193193 {
194194 QString topic = sm->getMqttTopicA () + " /" + sm->getMqttTopicB () + " /BTtoMQTT/" + mac_qstr_clean;
195195 bool status_mqtt = mq->publishData (topic, QString::fromStdString (output));
@@ -302,10 +302,12 @@ void DeviceManager::bleDevice_updated(const QBluetoothDeviceInfo &info, QBluetoo
302302 if (sm && mq && !mac_qstr_clean.isEmpty ())
303303 {
304304 QString topic = sm->getMqttTopicA () + " /" + sm->getMqttTopicB () + " /BTtoMQTT/" + mac_qstr_clean;
305- status_device = mq->publishData (topic, QString::fromStdString (output));
305+ bool status_mqtt = mq->publishData (topic, QString::fromStdString (output));
306+ if (!status_mqtt)
307+ {
308+ // qWarning() << "MQTT publishData(" << topic << ") FAILED >> " << output;
309+ }
306310 }
307-
308- status_device = true ;
309311 }
310312 }
311313 else
@@ -321,12 +323,12 @@ void DeviceManager::bleDevice_updated(const QBluetoothDeviceInfo &info, QBluetoo
321323
322324 if (m_scanning)
323325 {
324- if (status_gateway && info.name ().startsWith (" OMG_" ))
326+ if (! status_gateway && info.name ().startsWith (" OMG_" ))
325327 {
326328 // qDebug() << "addBleGateway(" << info.name() << ") FROM DYNAMIC SCANNING";
327329 addBleGateway (info);
328330 }
329- else if (status_device)
331+ else if (! status_device)
330332 {
331333 // qDebug() << "addBleDevice(" << info.name() << ") FROM DYNAMIC SCANNING";
332334 addBleDevice (info);
0 commit comments