correct wrong subject call when using HM10 <6xx ZgatewayBT
#225 and some traces improvments
This commit is contained in:
1 parent
f1651d67bf
commit
9b258723a8
1 file changed
+4
-4
+4
-4
@@ -224,7 +224,6 @@ boolean BTtoMQTT() {
|
|||||||
yield();
|
yield();
|
||||||
#endif
|
#endif
|
||||||
String token = returnedString.substring(pos);
|
String token = returnedString.substring(pos);
|
||||||
trc(token);
|
|
||||||
returnedString.remove(pos,returnedString.length() );
|
returnedString.remove(pos,returnedString.length() );
|
||||||
char token_char[token.length()+1];
|
char token_char[token.length()+1];
|
||||||
token.toCharArray(token_char, token.length()+1);
|
token.toCharArray(token_char, token.length()+1);
|
||||||
@@ -290,7 +289,7 @@ boolean BTtoMQTT() {
|
|||||||
discResult.replace(RESP_END_MSG,"");
|
discResult.replace(RESP_END_MSG,"");
|
||||||
float device_number = discResult.length()/78.0;
|
float device_number = discResult.length()/78.0;
|
||||||
if (device_number == (int)device_number){ // to avoid publishing partial values we detect if the serial data has been fully read = a multiple of 78
|
if (device_number == (int)device_number){ // to avoid publishing partial values we detect if the serial data has been fully read = a multiple of 78
|
||||||
trc(F("Sending BT data to MQTT"));
|
trc(F("Sending BT data to MQTT HM1X Version<v6xx"));
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
yield();
|
yield();
|
||||||
#endif
|
#endif
|
||||||
@@ -299,7 +298,7 @@ boolean BTtoMQTT() {
|
|||||||
onedevice.replace(STRING_MSG,"");
|
onedevice.replace(STRING_MSG,"");
|
||||||
String mac = onedevice.substring(53,65);
|
String mac = onedevice.substring(53,65);
|
||||||
String rssi = onedevice.substring(66,70);
|
String rssi = onedevice.substring(66,70);
|
||||||
String mactopic = subjectBTtoMQTT + mac + subjectBTtoMQTTRSSI;
|
String mactopic = subjectBTtoMQTT + mac + subjectBTtoMQTTrssi;
|
||||||
trc(mactopic + " " + rssi);
|
trc(mactopic + " " + rssi);
|
||||||
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
|
client.publish((char *)mactopic.c_str(),(char *)rssi.c_str());
|
||||||
discResult = discResult.substring(78);
|
discResult = discResult.substring(78);
|
||||||
@@ -326,7 +325,8 @@ boolean BTtoMQTT() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
boolean process_data(int offset, char * rest_data, char * mac_adress){
|
boolean process_data(int offset, char * rest_data, char * mac_adress){
|
||||||
|
trc(F("rest_data"));
|
||||||
|
trc(rest_data);
|
||||||
int data_length = 0;
|
int data_length = 0;
|
||||||
switch (rest_data[51 + offset]) {
|
switch (rest_data[51 + offset]) {
|
||||||
case '1' :
|
case '1' :
|
||||||
|
|||||||
Reference in new issue
Block a user