Closed xanderificnl closed 2 years ago
Here we go, the first actual scan (I saw) with data:
N: Device detected: 71:3A:F0:36:95:D0
N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":19,"tempf":66.2,"hum":66,"batt":100}
N: Send on /BTtoMQTT/713AF03695D0 msg {"id":"71:3A:F0:36:95:D0","mac_type":1,"manufacturerdata":"4c0010056e1cc98704","rssi":-91,"txpower":8}
N: Found 0 devices, scan number 802 end
: Device detected: C6:C7:52:66:3C:BF
N: Scan begin
N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf910f009342","rssi":-24}
N: Found 0 devices, scan number 822 end
Might the issue be that I assumed the meter readings should stay whereas they are only advertised when announced by the switchbot?
I feel absurdly stupid. Yes - the readings are all there. It was just my assumption that was wrong!
I feel absurdly stupid. Yes - the readings are all there. It was just my assumption that was wrong!
No, that is not the case!
There are too little proper readings from your SwitchBot Meter, and while you might have mistaken things a bit with the readings staying - they will once you incorporate the MQTT messages into a controller backend like Home Assistand, OpenHAB etc. - and looking at your data the decoder doesn't decode all the messages.
Do you have the SwitchBot Meter in Add Mode by any chance? If so can you switch it into Normal Mode?
It is the "servicedata"
whioch holds the information about the temperature, humidity and battery level, so you should never see any undecoded messages from your SwitchBot Meter which includes "servicedata"
.
If you still do, even after having the device in Normal Mode, please continue to post these messages here, as they then do not adhere to the SwitchBot documented encoding, but might be some not yet documented decoding of newly released Meters.
Then we can add those decoding guidelines to then Theengs Decoder for more frequent correctly decoded messages.
It was a pebkac (problem exists between keyboard and computer). Clearly, my assumptions made me blind for what was right in front of me, i.e. this project merely mirroring signals from bluetooth to MQTT.
I do apologize for wasting your time @DigiH. And I do want to express my gratitude to all maintainers and developers for making an awesome project. Hopefully not all users are so blind as me haha.
Can we close this?
Please see my message above, while you might have mistaken a few things a bit, you are very correct in stating that not all the messages are decoded which could/should be decoded, due to the fast that your SwitchBot Meter might be a very recent purchase with a slightly newer format which isn't fully recognised by the Decoder yet.
So thanks for pointing this out!
There should never be any message from your SwitchBot Meter which has any "servicedata"
in it and it is not decoded, like the one below.
If there is only "manufacturerdata"
that is another case and can safely be ignored.
# home/OpenMQTTGateway_ESP32_BLE_C/BTtoMQTT/C6C752663CBF
{
"id": "C6:C7:52:66:3C:BF",
"mac_type": 1,
"manufacturerdata": "6909c6c752663cbf8d0f099242",
"rssi": -36,
"servicedata": "49c0e4099242",
"servicedatauuid": "0xfd3d"
}
Thanks. I feel a tad less stupid now!
So the servicedata was a pretty common occurence, and while I looked through your code last night - I did pick up on it containing the readings. That's why I figured there was something wrong, I also tried compiling with your decoder library but that made no difference.
I'm guessing the "add" mode is when I'm pressing the button? For what it's worth, the other project* has been running since yesterday and has been updating my broker very regularly.
What can I do to help with the new format?
What can I do to help with the new format?
If you are compiling your builds with Platformio, you can just change the Decoder URL in the platformio.ini file from
decoder = https://github.com/theengs/decoder.git#v0.6.2
to
decoder = https://github.com/DigiH/decoder#SBMT-test
to test the decoder changes I just uploaded. Then rebuild and upload OMG again to your ESP32.
You should not see any undecoded messages now which include "servicedata"
, and as you said, they were quite a few of those before, they should now all be properly decoded messages, and therefore more frequent.
Adding the device ID (i.e. the SBMT-test branch) has worked. Here's what's happening now:
This is sweet! I think this resolves the issue and now I have every excuse I need to get working on OMG <-> Homie integration ;-)
Thank you @DigiH, much appreciated and such speed!
This is sweet! I think this resolves the issue and now I have every excuse I need to get working on OMG <-> Homie integration ;-)
Great, I'll will be looking forward to your Homie integration!
Thank you @DigiH, much appreciated and such speed!
Thank you for pointing this out, and helping along to pinpoint and verify this different ID! As this is not documented on the official SwitchBot API pages (yet).
I have merged this into the official Theengs Decoder development branch, and will delete my test branch soon. So if you have to rebuild for any reason please use
decoder = https://github.com/theengs/decoder
for any future builds.
Thanks again!
Please also close this OMG issue, if you're happy with the changes. Thanks
This is sweet! I think this resolves the issue and now I have every excuse I need to get working on OMG <-> Homie integration ;-)
Great, I'll will be looking forward to your Homie integration!
I'm almost looking forward to fighting with the compiler! I do love the language but man, compilers and I never C eye to eye ;)
Thank you @DigiH, much appreciated and such speed!
Thank you for pointing this out, and helping along to pinpoint and verify this different ID! As this is not documented on the official SwitchBot API pages (yet).
You're most welcome!
I have merged this into the official Theengs Decoder development branch, and will delete my test branch soon. So if you have to rebuild for any reason please use
decoder = https://github.com/theengs/decoder
for any future builds.
Just rebuilded to switch back from *-cont to esp32-dev-ble and used that repository.
Thanks again!
Please also close this OMG issue, if you're happy with the changes. Thanks
I am happy with the solution. I'm going to put on some monitoring and have it run over night, see how many times it published sensor data - and hopefully this can be the start of a beautiful array of BLE devices broadcasting sensors for OMG to pick up.
Cheers!
After @DigiH fixed the issue, I recompiled to esp32-dev-ble (verified it used the fix) and had two ESP32's running side by side.
One with OMG and another with SwitchBot-MQTT-BLE-ESP32. Both with the defaults + WiFi configuration.
I monitored them via a tmux-background window and mosquitto-sub, i.e.:
mosquitto_sub -h 172.16.32.2 -t home/OpenMQTTGateway_ESP32_BLE/BTtoMQTT/C6C752663CBF | ax -o json | tee log/openmqttgateway.log
mosquitto_sub -h 172.16.32.2 -t switchbot/switchbot-relay/meter/one/attributes | ax -o json | tee log/switcbot-mqtt-ble-esp32.log
The log files are here: switcbot-mqtt-ble-esp32.log and openmqttgateway.log
Here are some interesting bits:
$ wc -l ./openmqttgateway.log
5812 ./openmqttgateway.log
$ grep 'tempc' ./openmqttgateway.log | wc -l
170
$ wc -l ./switcbot-mqtt-ble-esp32.log
897 ./switcbot-mqtt-ble-esp32.log
In short:
I'm going to restart the *-cont version to see how often it'll report sensor data. I do recall it showing 10+ sensor readings in a small window
@DigiH can you advise? I'm guessing 170 sensor readings over 5 days is very low. Am I missing something?
Hi @xanderificnl
I'm guessing 170 sensor readings over 5 days is very low. Am I missing something?
Yes, absolutely, and great that you made these logs. The openmqttgateway.log clearly shows that most of the messages received from the SwitchBot Meter have manufacturerdata only in them, missing the servicedata required for Theengs Decpder decoding.
I'm going to restart the *-cont version to see how often it'll report sensor data.
Did you see any changes with the *-cont version, more specifically, was more data with servicedata being picked up and was therefor decoded?
Do you have a sample log with the *-cont version?
I just looked at the official SwitchBot BLE API again and realised that there are two formats for the Meters:
(Old) Broadcast Message - Manufacturer data (New) Broadcast Message - Service data
If and why your Meter seems to send out both formats, and if the manufacturerdata contains all the information - I'll have to have a closer look, only saw that the last byte looks like being the humidity.
Which firmware version does your Meter have? Might there be a firmware update for it in the SwitchBot app?
Any chance of resetting your Meter, to see how it behaves after a default resetting/new start?
Generally I'd expect the Meter to be picked up roughly every minutes, as it already is now with the default OMG BLE binary, but with it transmitting data which can/is being decoded, so correct data from the Meter every minute.
As I don't have a SwitchBot Meter myself I just checked with a colleague, and his logging shows the opposite of yours. In general the messages received by his SwitchBot Meter do contain both the manufacturerdata and servicedata, with the servicedata correctly being decoded and the wanted information included in the messages.
Only now and then his Meter messages also only contain the manufacturerdata and are not being decoded, which unfortunately is the majority with your device.
Thanks
Hi.
Hopefully I haven't missed answering a question.
rcom -d /dev/ttyUSB0 | grep SwitchBot
w/o storing any logs. It had about 3 results in 30 minutes.TZ=UTC rcom -d /dev/ttyUSB0 | tee serial.log
. See below.[platformio]
; default_envs = esp32dev-ble
default_envs = esp32dev-ble-datatest
[libraries]
decoder = https://github.com/theengs/decoder
; #development
; decoder = https://github.com/DigiH/decoder#SBMT-test
;decoder = https://github.com/theengs/decoder
[env:esp32dev-ble-datatest]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DLED_SEND_RECEIVE=2'
'-DLED_SEND_RECEIVE_ON=0'
'-DpubBLEManufacturerData=true'
'-DpubKnownBLEServiceData=true'
'-DpubBLEServiceUUID=true'
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
'-DMQTT_SERVER="172.16.32.2"'
'-DMQTT_USER="username"'
'-DMQTT_PASS="pwd"'
'-Dwifi_ssid="XiFi"'
'-Dwifi_password="l3ttersandnumbers"'
At 16:03 (UTC) I pressed the bluetooth button to see what would happen, the bluetooth indicator lighted and it got picked up. So there may be a bit of a nuance in the data around that timestamp.
$ TZ=UTC rcom -d /dev/ttyUSB0 | tee serial.log
[15:57:03.0016] rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
[15:57:03.0066] configsip: 0, SPIWP:0xee
[15:57:03.0086] clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
[15:57:03.0145] mode:DIO, clock div:2
[15:57:03.0166] load:0x3fff0018,len:4
[15:57:03.0187] load:0x3fff001c,len:1044
[15:57:03.0218] load:0x40078000,len:10124
[15:57:03.0236] load:0x40080400,len:5828
[15:57:03.0256] entry 0x400806a8
[15:57:03.6081] N:
[15:57:03.6086] ************* WELCOME TO OpenMQTTGateway **************
[15:57:03.6136] N: OpenMQTTGateway Version: version_tag
[15:57:03.7625] *WM: [1] Free heap: 151860
[15:57:03.7656] *WM: [1] ESP-IDF version: v3.3.5-1-g85c43024c
[15:57:03.7696] *WM: [3] allocating params bytes: 20
[15:57:03.7735] *WM: [2] Added Parameter: server
[15:57:03.7765] *WM: [2] Added Parameter: port
[15:57:03.7819] *WM: [2] Added Parameter: user
[15:57:03.7819] *WM: [2] Added Parameter: pass
[15:57:03.7846] *WM: [2] Added Parameter: secure
[15:57:03.7875] *WM: [3] Updated _max_params: 10
[15:57:03.7907] *WM: [3] re-allocating params bytes: 40
[15:57:03.7945] *WM: [2] Added Parameter: cert
[15:57:03.7965] *WM: [2] Added Parameter: name
[15:57:03.7996] *WM: [2] Added Parameter: topic
[15:57:03.8026] N: Attempting Wifi connection with saved AP: 0
[15:57:04.2972] N: Attempting Wifi connection with saved AP: 1
[15:57:04.3016] E (919) wifi:sta is connecting, return error
[15:57:04.3057] [E][WiFiSTA.cpp:221] begin(): connect failed!
[15:57:04.7992] N: Attempting Wifi connection with saved AP: 2
[15:57:04.8038] E (1421) wifi:sta is connecting, return error
[15:57:04.8075] [E][WiFiSTA.cpp:221] begin(): connect failed!
[15:57:05.3011] N: Attempting Wifi connection with saved AP: 3
[15:57:05.3056] E (1923) wifi:sta is connecting, return error
[15:57:05.3096] [E][WiFiSTA.cpp:221] begin(): connect failed!
[15:57:05.8031] N: Attempting Wifi connection with saved AP: 4
[15:57:05.8076] E (2425) wifi:sta is connecting, return error
[15:57:05.8115] [E][WiFiSTA.cpp:221] begin(): connect failed!
[15:57:06.3051] N: Connect your phone to WIFI AP: OpenMQTTGateway_ESP32_BLE with PWD: your_password
[15:57:06.3125] *WM: [1] AutoConnect
[15:57:06.3146] *WM: [2] ESP32 event handler enabled
[15:57:06.3186] *WM: [1] AutoConnect: ESP Already Connected
[15:57:06.3227] *WM: [1] STA static IP:
[15:57:06.3247] *WM: [2] setSTAConfig static ip not set
[15:57:06.3276] *WM: [1] AutoConnect: SUCCESS
[15:57:06.3306] *WM: [1] STA IP Address: 192.168.88.231
[15:57:07.8327] [E][Preferences.cpp:472] getString(): nvs_get_str len fail: BTConfig NOT_FOUND
[15:57:07.8396] N: BT config loaded
[15:57:07.8416] N: BT config: {
[15:57:07.8436] "bleconnect": true,
[15:57:07.8455] "interval": 55555,
[15:57:07.8475] "scanbcnct": 10,
[15:57:07.8485] "onlysensors": false,
[15:57:07.8553] "hasspresence": false,
[15:57:07.8553] "presenceTopic": "presence/",
[15:57:07.8678] "presenceUseBeaconUuid": false,
[15:57:07.8678] "minrssi": -100,
[15:57:07.8678] "extDecoderEnable": false,
[15:57:07.8678] "extDecoderTopic": "undecoded",
[15:57:07.8678] "filterConnectable": false,
[15:57:07.8702] "pubKnownServiceData": true,
[15:57:07.8717] "pubUnknownServiceData": true,
[15:57:07.8746] "pubKnownManufData": true,
[15:57:07.8776] "pubUnknownManufData": true,
[15:57:07.8818] "pubServiceDataUUID": true,
[15:57:07.8836] "pubBeaconUuidForTopic": false,
[15:57:07.8865] "ignoreWBlist": false
[15:57:07.8886] }
[15:57:07.8886] N: BT config loaded
[15:57:07.8906] N: BLE scans interval: 55555
[15:57:07.8926] N: BLE scans number before connect: 10
[15:57:07.8966] N: Publishing only BLE sensors: false
[15:57:07.8996] N: minrssi: -100
[15:57:07.9005] N: Low Power Mode: 0
[15:57:08.0855] N: OpenMQTTGateway modules: ["BT"]
[15:57:08.0887] N: ************** Setup OpenMQTTGateway end **************
[15:57:08.0936] W: MQTT connection...
[15:57:08.1462] N: Connected to broker
[15:57:08.2223] N: Send on /SYStoMQTT msg {"uptime":4,"version":"version_tag","freemem":132232,"mqttport":"1883","mqttsecure":false,"freestack":4756,"rssi":-45,"SSID":"XiFi","BSSID":"08:55:31:D6:79:49","ip":"192.168.88.231","mac":"34:86:5D:FD:4F:08","lowpowermode":0,"btqblck":0,"btqsum":0,"btqsnd":0,"btqavg":0,"interval":55555,"scanbcnct":10,"scnct":0,"modules":["BT"]}
[15:57:09.0853] N: Scan begin
[15:57:15.5942] N: Device detected: C6:C7:52:66:3C:BF
[15:57:15.6457] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf010b02924f","rssi":-37,"servicedata":"6980e402924c","servicedatauuid":"0xfd3d","brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.2,"tempf":64.76,"hum":76,"batt":100}
[15:57:17.9453] N: Device detected: C5:A0:54:C5:5A:E2
[15:57:17.9895] N: Send on /BTtoMQTT/C5A054C55AE2 msg {"id":"C5:A0:54:C5:5A:E2","mac_type":1,"manufacturerdata":"4c0012020003","rssi":-28}
[15:57:19.0966] N: Found 2 devices, scan number 1 end
[15:57:19.1006] N: BLE Connect begin
[15:57:19.1027] N: BLE Connect end
[15:58:14.6571] N: Scan begin
[15:58:22.0124] N: Device detected: C5:A0:54:C5:5A:E2
[15:58:22.0568] N: Send on /BTtoMQTT/C5A054C55AE2 msg {"id":"C5:A0:54:C5:5A:E2","mac_type":1,"manufacturerdata":"4c0012020003","rssi":-31}
[15:58:24.6665] N: Found 2 devices, scan number 2 end
[15:58:24.6704] N: Device detected: C6:C7:52:66:3C:BF
[15:58:24.7114] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf030b04924c","rssi":-37}
[15:59:08.2137] N: Send on /SYStoMQTT msg {"uptime":124,"version":"version_tag","freemem":139068,"mqttport":"1883","mqttsecure":false,"freestack":3444,"rssi":-47,"SSID":"XiFi","BSSID":"08:55:31:D6:79:49","ip":"192.168.88.231","mac":"34:86:5D:FD:4F:08","lowpowermode":0,"btqblck":0,"btqsum":4,"btqsnd":4,"btqavg":1,"interval":55555,"scanbcnct":10,"scnct":2,"modules":["BT"]}
[15:59:20.2280] N: Scan begin
[15:59:24.0554] N: Device detected: C5:A0:54:C5:5A:E2
[15:59:24.0996] N: Send on /BTtoMQTT/C5A054C55AE2 msg {"id":"C5:A0:54:C5:5A:E2","mac_type":1,"manufacturerdata":"4c0012020003","rssi":-32}
[15:59:30.2376] N: Found 2 devices, scan nuN: mDevice detectebd: C6:C7:52:66:3C:BF
[15:59:30.2442] er 3 end
[15:59:30.2830] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf030b04924c","rssi":-38}
[16:00:25.8028] N: Scan begin
[16:00:26.4665] N: Device detected: E4:8F:4C:26:CE:EE
[16:00:26.5107] N: Send on /BTtoMQTT/E48F4C26CEEE msg {"id":"E4:8F:4C:26:CE:EE","mac_type":1,"manufacturerdata":"4c0012020000","rssi":-31}
[16:00:35.8144] N: Found 2 devices, scan number 4 end
[16:00:35.8194] N: Device detected: C6:C7:52:66:3C:BF
[16:00:35.8587] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf040b04924a","rssi":-37}
[16:01:08.2136] N: Send on /SYStoMQTT msg {"uptime":244,"version":"version_tag","freemem":139064,"mqttport":"1883","mqttsecure":false,"freestack":3444,"rssi":-46,"SSID":"XiFi","BSSID":"08:55:31:D6:79:49","ip":"192.168.88.231","mac":"34:86:5D:FD:4F:08","lowpowermode":0,"btqblck":0,"btqsum":8,"btqsnd":8,"btqavg":1,"interval":55555,"scanbcnct":10,"scnct":4,"modules":["BT"]}
[16:01:31.3771] N: Scan begin
[16:01:32.5069] N: Device detected: E4:8F:4C:26:CE:EE
[16:01:32.5513] N: Send on /BTtoMQTT/E48F4C26CEEE msg {"id":"E4:8F:4C:26:CE:EE","mac_type":1,"manufacturerdata":"4c0012020000","rssi":-31}
[16:01:41.3867] N: Found 2 devices, scan number N5: eDevice detected: C6:C7:52:66:3C:BF
[16:01:41.3933] nd
[16:01:41.4319] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf050b03924a","rssi":-38}
[16:02:36.9539] N: Scan begin
[16:02:40.5621] N: Device detected: E4:8F:4C:26:CE:EE
[16:02:40.6061] N: Send on /BTtoMQTT/E48F4C26CEEE msg {"id":"E4:8F:4C:26:CE:EE","mac_type":1,"manufacturerdata":"4c0012020000","rssi":-26}
[16:02:46.9651] N: Device detected: C6:C7:52:66:3C:BF
[16:02:46.9693] N: Found 2 devices, scan number 6 end
[16:02:47.0095] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf050b03924a","rssi":-37}
[16:03:08.1974] N: Send on /SYStoMQTT msg {"uptime":364,"version":"version_tag","freemem":138884,"mqttport":"1883","mqttsecure":false,"freestack":3444,"rssi":-49,"SSID":"XiFi","BSSID":"08:55:31:D6:79:49","ip":"192.168.88.231","mac":"34:86:5D:FD:4F:08","lowpowermode":0,"btqblck":0,"btqsum":12,"btqsnd":12,"btqavg":1,"interval":55555,"scanbcnct":10,"scnct":6,"modules":["BT"]}
[16:03:42.5320] N: Scan begin
[16:03:43.5356] N: Device detected: C6:C7:52:66:3C:BF
[16:03:43.5699] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf050b03924a","rssi":-31,"servicedata":"4980e403924a","servicedatauuid":"0xfd3d","brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.3,"tempf":64.94,"hum":74,"batt":100}
[16:03:52.5419] N: Found 1 devices, scan number 7 end
[16:04:48.1079] N: Scan begin
[16:04:49.4824] N: Device detected: C6:C7:52:66:3C:BF
[16:04:49.5162] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf050b03924a","rssi":-33,"servicedata":"4980e403924a","servicedatauuid":"0xfd3d","brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.3,"tempf":64.94,"hum":74,"batt":100}
[16:04:52.6639] N: Device detected: E4:8F:4C:26:CE:EE
[16:04:52.7075] N: Send on /BTtoMQTT/E48F4C26CEEE msg {"id":"E4:8F:4C:26:CE:EE","mac_type":1,"manufacturerdata":"4c0012020000","rssi":-33}
[16:04:58.1198] N: Found 3 devices, scan nuN: mDevice detectebd: 3C:91:80:C9:28:58
[16:04:58.1264] er 8 end
[16:04:58.1264] N: Send on /BTtoMQTT/3C9180C92858 msg {"id":"3C:91:80:C9:28:58","mac_type":0,"rssi":-81}
[16:05:08.1890] N: Send on /SYStoMQTT msg {"uptime":484,"version":"version_tag","freemem":138744,"mqttport":"1883","mqttsecure":false,"freestack":3444,"rssi":-48,"SSID":"XiFi","BSSID":"08:55:31:D6:79:49","ip":"192.168.88.231","mac":"34:86:5D:FD:4F:08","lowpowermode":0,"btqblck":0,"btqsum":16,"btqsnd":16,"btqavg":1,"interval":55555,"scanbcnct":10,"scnct":8,"modules":["BT"]}
[16:05:53.6860] N: Scan begin
[16:05:56.7341] N: Device detected: E4:8F:4C:26:CE:EE
[16:05:56.7783] N: Send on /BTtoMQTT/E48F4C26CEEE msg {"id":"E4:8F:4C:26:CE:EE","mac_type":1,"manufacturerdata":"4c0012020000","rssi":-33}
[16:05:58.3342] N: Device detected: C6:C7:52:66:3C:BF
[16:05:58.3680] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf060b02924a","rssi":-30,"servicedata":"6980e402924a","servicedatauuid":"0xfd3d","brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.2,"tempf":64.76,"hum":74,"batt":100}
[16:06:03.6935] N: Found 3 devices, scan number 9 end
[16:06:03.6973] N: Device detected: 3C:91:80:C9:28:58
[16:06:03.7003] N: Send on /BTtoMQTT/3C9180C92858 msg {"id":"3C:91:80:C9:28:58","mac_type":0,"rssi":-81}
[16:06:59.2570] N: Scan begin
[16:07:08.1807] N: Send on /SYStoMQTT msg {"uptime":604,"version":"version_tag","freemem":138900,"mqttport":"1883","mqttsecure":false,"freestack":3444,"rssi":-48,"SSID":"XiFi","BSSID":"08:55:31:D6:79:49","ip":"192.168.88.231","mac":"34:86:5D:FD:4F:08","lowpowermode":0,"btqblck":0,"btqsum":19,"btqsnd":19,"btqavg":1,"interval":55555,"scanbcnct":10,"scnct":9,"modules":["BT"]}
[16:07:09.2667] N: Found N: Device detected: C6:C7:52:66:3C:BF
[16:07:09.2713] 2 devices, scan number 10 end
[16:07:09.2743] N: BLE Connect begin
[16:07:09.2753] N: BLE Connect end
[16:07:09.3107] N: Device detected: 50:CB:2D:D9:62:25
[16:07:09.3542] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf060b02924a","rssi":-29}
[16:07:09.3663] N: Send on /BTtoMQTT/50CB2DD96225 msg {"id":"50:CB:2D:D9:62:25","mac_type":1,"manufacturerdata":"4c0010054e1c3b4881","rssi":-90,"txpower":12}
[16:08:04.8319] N: Scan begin
[16:08:14.8325] N: Device detected: E4:8F:4C:26:CE:EE
[16:08:14.8412] N: Found 3 devices, scan number 11 end
[16:08:14.8766] N: Device detected: 3C:91:80:C9:28:58
[16:08:14.8803] N: Device detected: C6:C7:52:66:3C:BF
[16:08:14.9207] N: Send on /BTtoMQTT/E48F4C26CEEE msg {"id":"E4:8F:4C:26:CE:EE","mac_type":1,"manufacturerdata":"4c0012020000","rssi":-28}
[16:08:14.9313] N: Send on /BTtoMQTT/3C9180C92858 msg {"id":"3C:91:80:C9:28:58","mac_type":0,"rssi":-80}
[16:08:14.9394] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf060b02924a","rssi":-33}
Hi,
The 'fix' I implemented previously, which allows for the 49… servicedata to be decoded, should actually be taken out again, as 49… servicedata indicates being in ADD MODE, which only last for 120 seconds, as can be seen in your
At 16:03 (UTC) I pressed the bluetooth button to see what would happen, the bluetooth indicator lighted and it got picked up. So there may be a bit of a nuance in the data around that timestamp.
but will/should never appear in normal broadcast mode.
8. I'll publish a longer log after a couple of hours - can you confirm this is the kind of data you're looking for?
Yes, the configuration looks fine, the steps you follow sound fine, but why so many manufacturerdata only messages is still a mystery to me.
If the longer log will be not serial, but as the above ones with mosquitto-sub, that will be great.
Just out of curiosity - you haven't set ActiveBLEScan in config_BT.h to false by any chance, possibly for some other environment/test?
Have all the different OMG tests been done on the same ESP32?
Looking forward to your longer logs.
Hi,
Before filing this issue, I repulled 0.9.16 and had a clean tree. Today I moved to the development branch. Git reports my tree is clean (gitignore ignores env files). So ActiveBLEScan is default, in config_BT.h:
$ grep 'define ActiveBLEScan' main/config_BT.h
# define ActiveBLEScan true // Set active scanning, this will get more data from the advertiser.
I've started a subscriber for mosquitto-sub
Things do appear to be going much better so far. I've had more sensor readings by OMG than I've had in the past 10 days.
Here's a preview of the formatted logs so far:
{"@timestamp":"2022-10-22T19:26:56+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf110b09914b","rssi":-29}
{"@timestamp":"2022-10-22T19:29:07+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf110b09914b","rssi":-29}
{"@timestamp":"2022-10-22T19:31:18+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf110b09914b","rssi":-33}
{"@timestamp":"2022-10-22T19:32:24+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf110b09914b","rssi":-33}
{"@timestamp":"2022-10-22T19:33:28+02:00","batt":100,"brand":"SwitchBot","hum":75,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf120b09914b","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"6980e409914b","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T19:34:35+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf120b09914b","rssi":-32}
{"@timestamp":"2022-10-22T19:35:41+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf120b09914b","rssi":-29}
{"@timestamp":"2022-10-22T19:36:36+02:00","batt":100,"brand":"SwitchBot","hum":75,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf120b09914b","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"6980e409914b","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T19:37:43+02:00","batt":100,"brand":"SwitchBot","hum":75,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf120b09914b","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914b","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
- edit -
I've ran OMG on 2 different ESPs. One of those is was eventually flashed with SwitchBot-MQTT-ESP - which is currently off.
The [env:esp32dev-ble-datatest]
environment looks fine. Could you just add the build_flags?
'-DTimeBtwRead=0'
'-DScan_duration=1000'
'-DAttemptBLECOnnect=false'
to make it a env:esp32dev-ble-datatest-cont
. Logging for ten minutes or so should be more than enough then to see what the different broadcast ratios are.
Thanks
For completeness: it reported sensor readings 43 times in approximately 2 hours. A lot more than previously - but still less than what your friend sees.
switched to the new build flags, and here's the log:
{"@timestamp":"2022-10-22T19:59:08+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T19:59:13+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T19:59:25+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T19:59:31+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-33}
{"@timestamp":"2022-10-22T19:59:33+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-33}
{"@timestamp":"2022-10-22T19:59:37+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T19:59:39+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T19:59:45+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-81}
{"@timestamp":"2022-10-22T19:59:47+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T19:59:49+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T19:59:53+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T19:59:55+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-62}
{"@timestamp":"2022-10-22T20:00:03+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:05+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:00:13+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:19+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:23+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:00:27+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:29+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:33+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:35+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:41+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:00:43+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:00:57+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:01:02+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:01:04+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:01:10+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:01:11+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:01:18+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:01:26+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:01:27+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:01:35+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:01:41+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:01:53+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:01:55+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:01:59+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:01+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:07+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:02:09+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:02:13+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:02:17+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:02:19+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-34}
{"@timestamp":"2022-10-22T20:02:25+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:27+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:02:32+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:02:36+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:40+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:42+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:50+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:54+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:02:56+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:02:58+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:02+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:04+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:08+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:03:10+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:03:18+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:20+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:24+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:26+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:32+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:38+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:39+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:03:46+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf150b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:03:48+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:03:56+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:04:02+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:08+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:04:10+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:04:14+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:23+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:25+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:26+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-32,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:04:30+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:04:39+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:41+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:47+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:04:49+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:04:55+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:05:03+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:05:12+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:05:15+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:05:22+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:05:26+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:05:32+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:05:34+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:05:40+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:05:42+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:05:50+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-31}
{"@timestamp":"2022-10-22T20:05:54+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:05:56+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-32}
{"@timestamp":"2022-10-22T20:05:58+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:06:05+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:06:11+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:06:12+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:06:19+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:06:21+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:06:27+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-81}
{"@timestamp":"2022-10-22T20:06:29+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:06:35+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:06:37+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:06:43+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-31}
{"@timestamp":"2022-10-22T20:06:45+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-31}
{"@timestamp":"2022-10-22T20:06:51+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:06:53+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:07:01+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:07:07+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:07:13+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:07:15+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:07:19+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:07:20+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:07:27+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:07:29+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:07:38+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:07:42+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:07:48+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:07:55+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-78}
{"@timestamp":"2022-10-22T20:07:59+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:08:06+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:08:15+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:08:17+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:08:22+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:08:25+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:08:27+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:08:30+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:08:33+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:08:37+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:08:41+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:08:43+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:08:51+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:08:53+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:08:59+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:09:01+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-30}
{"@timestamp":"2022-10-22T20:09:09+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
{"@timestamp":"2022-10-22T20:09:11+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-31,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
{"@timestamp":"2022-10-22T20:09:15+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
5 12 14 8 70 14 16 8 6 26 2 4 14 72 9 20 18 4 42 10 12 38 68 28 18 16 2 6 10 31 14 104 22 24 8 6 6 10 38 20 8 8 7 1 13 20 16 51 26 10 22 19 32 6 8 8 54 8
- edit -
Just unpacked a new ESP for testing; and it -won't- connect to WiFi with the exact same configuration, i.e. all I did was press "upload". Starting to wonder if there may be remnants of a previous configuration dangling around on the other 2 ESPs.
Added '-DESPWifiManualSetup=true' and now it connects fine. Curious to see what results I'm getting on a brand new ESP.
Wow. On a brand new ESP, with these opts:
[env:esp32dev-ble-datatest]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DLED_SEND_RECEIVE=2'
'-DLED_SEND_RECEIVE_ON=0'
'-DpubBLEManufacturerData=true'
'-DpubKnownBLEServiceData=true'
'-DpubBLEServiceUUID=true'
'-DGateway_Name="OpenMQTTGateway_ESP32_BLE"'
'-DMQTT_SERVER="172.16.32.2"'
'-DMQTT_USER="username"'
'-DMQTT_PASS="pwd"'
'-Dwifi_ssid="XiFi"'
'-Dwifi_password="snip"'
'-DTimeBtwRead=0'
'-DScan_duration=1000'
'-DAttemptBLECOnnect=false'
'-DESPWifiManualSetup=true'
This is happening:
{"@timestamp":"2022-10-22T20:41:13+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-27}
{"@timestamp":"2022-10-22T20:41:22+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:41:26+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:41:34+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:41:36+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:41:42+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:41:46+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-28}
{"@timestamp":"2022-10-22T20:41:56+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:41:58+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-32,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:42:00+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-32,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:42:06+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-32,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:42:08+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-29,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:42:16+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:42:22+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-29}
{"@timestamp":"2022-10-22T20:42:32+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-32,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:42:38+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-31}
{"@timestamp":"2022-10-22T20:42:40+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-27}
{"@timestamp":"2022-10-22T20:42:54+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-28,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:43:04+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:43:10+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:43:12+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:43:18+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-30,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:43:27+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-28}
{"@timestamp":"2022-10-22T20:43:29+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-28}
{"@timestamp":"2022-10-22T20:43:32+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-32,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T20:43:41+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf1d0b009249","rssi":-31}
(I did believe the "upload" on platformio did that.)
So something weird happened. I grabbed an ESP32 that was lying around, I pressed 'upload' and it wasn't able to connect to WiFi. FIgured it was a fluke, and unpacked a new one. Same problem.
Added the '-DESPWifiManualSetup=true'
flag, and it did work. A flag I had used before on the other 2 ESPs.
So apparently the other 2 ESPs still have dangling settings running afoul?
Just unpacked a new ESP for testing; and it -won't- connect to WiFi with the exact same configuration, i.e. all I did was press "upload". Starting to wonder if there may be remnants of a previous configuration dangling around on the other 2 ESPs.
Best to erase the Flash before uploading a new configuration to a new or well used ESP32. Worth a try with these two.
(I did believe the "upload" on platformio did that.)
esptool.py --port /dev/ttyUSB0 erase_flash
in the platformio terminal will do the trick.
time (in seconds) between sensor readings:
5 12 14 8 70 14 16 8 6 26 2 4 14 72 9 20 18 4 42 10 12 38 68 28 18 16 2 6 10 31 14 104 22 24 8 6 6 10 38 20 8 8 7 1 13 20 16 51 26 10 22 19 32 6 8 8 54 8
Well, more regular decoded readings than the previous switcbot-mqtt-ble-esp32.log
now, undecoded 'breaks' not more than roughly a minute apart.
Still very curious as to why there are so many more manufacturerdata only messages than decoded ones including the servicedata, when it should be the other way round.
But this clearly shows that with the default
'-DTimeBtwRead=55000'
'-DScan_duration=10000'
the 10 second scan window every 55 seconds could/would easily fall into several manufacturerdata only broadcasts, continuously only showing these for a long time, even if correctly decoded servicedata messages had been broadcast during the TimeBtwRead - when no OMG scan occurs. What you saw before with the default environment/binary.
Is/was the SwitchBot Meter linked to a SwitchBot Hub at all?
Any improvements after clearing the flash before a new upload?
Added the
'-DESPWifiManualSetup=true'
flag, and it did work. A flag I had used before on the other 2 ESPs.
if you use manual WiFi and MQTT broker credentials, as in your environment above
'-DMQTT_SERVER="172.16.32.2"'
'-DMQTT_USER="username"'
'-DMQTT_PASS="pwd"'
'-Dwifi_ssid="XiFi"'
'-Dwifi_password="snip"'
you will always also have to set
'-DESPWifiManualSetup=true'
as otherwise the above should be recognised. As it is indicated in the above environment.
Yeah, so I did start off with the binary release - and that didn't give me sensor data. So I moved on to building myself and fiddling with settings. So presumably increasing the window might solve the issue?
I don't have or own a hub.
So on the brand new ESP is off and I've wiped one of the previous ESPs, cleaned the environment, built and uploaded it. These are the logs:
{"@timestamp":"2022-10-22T21:08:54+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf200b009249","rssi":-25}
{"@timestamp":"2022-10-22T21:09:01+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-25}
{"@timestamp":"2022-10-22T21:09:02+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-24}
{"@timestamp":"2022-10-22T21:09:06+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-23}
{"@timestamp":"2022-10-22T21:09:08+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-24}
{"@timestamp":"2022-10-22T21:09:10+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-25}
{"@timestamp":"2022-10-22T21:09:12+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-23}
{"@timestamp":"2022-10-22T21:09:16+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-24}
{"@timestamp":"2022-10-22T21:09:18+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-27,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T21:09:20+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-26}
{"@timestamp":"2022-10-22T21:09:26+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-23}
{"@timestamp":"2022-10-22T21:09:28+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-26}
{"@timestamp":"2022-10-22T21:09:30+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-26}
{"@timestamp":"2022-10-22T21:09:32+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-24}
{"@timestamp":"2022-10-22T21:09:36+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-24}
{"@timestamp":"2022-10-22T21:09:42+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-26}
{"@timestamp":"2022-10-22T21:09:44+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-24}
{"@timestamp":"2022-10-22T21:09:50+02:00","batt":100,"brand":"SwitchBot","hum":73,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-26,"servicedata":"698064009249","servicedatauuid":"0xfd3d","tempc":18,"tempf":64.4}
{"@timestamp":"2022-10-22T21:09:52+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf210b009249","rssi":-23}
So the brand new ESP actually flooded the logs with sensor data but that also returned to manufacturerdata. So it was mostlikely a fluke.
Presumably changing/increase the window would solve it?
with regards to the window: I wasn't reading correctly. You meant with the regular release, not the adjusted settings we've been using, correct?
you will always also have to set
'-DESPWifiManualSetup=true'
Yes, but with the ESP I had been testing on, I hadn't set that flag for the datatest environment. It still connected to WiFi whereas 2 other ESPs failed to do so. So there must have been dangling resources/configuration going on.
- I'm inclinded to let the new ESP run for a night and see how it fares. So far it's been doing so much better even though it does seem to get flooded with manufacturer-only messages everyonce in a while.
Presumably changing/increase the window would solve it?
Yes, I would think having a go with the TimeBtwRead
and Scan_duration
should give you a usable result, as the continuous scanning showed that you can catch a decoded message at least every minute.
Just to show that something is still amiss is the comparison between your -cont log and the colleague's -cont log
That right side would also be the ideal for your SwichBot Meter as well!
Why there seems to be a majority of manufacturerdata only messages is beyond me at this stage, but I think we found, that with nicely adjusted TimeBtwRead
and Scan_duration
settings you can get a workable OMG setup, with at least one correct decoded reading every minute.
with regards to the window: I wasn't reading correctly. You meant with the regular release, not the adjusted settings we've been using, correct?
Correct, that was meant for the regular default ble release, using these default settings as a comparison.
That's a huge difference. With the new ESP, I've been seeing only manufacturer data for more than 5 minutes now and that's with esp32dev-ble-datatest
.
I'm going to google around some more and see if I can find a project that allows me to use an ESP32 as a BLE-receiver and inspect that data in Wireshark. Presumably, we'd get a little bit more raw information about what's going on.
Something tells me that my Switchbot is looking for a hub, or it maybe found a hub (that isn't mine) somewhere near me. Or that it's looking for registration or something along those lines. i.e. that it's saying "I'm here" w/ the manufacturer only data.
Thanks for the help. It's really nice, I'll update when I get the chance!
Hello,
Do you mind sharing a picture of the back of your sensor. Here is mind that report constantly data:
The goal is to check for any model difference.
Mine seems to have an extra IC-field (next to the FCC-ID) but besides that I see no informational differences
Additional information. Here are the latest log results (monitoring +-24.5 hours):
Log file (3.1mb - mind you, grep thinks it contains binary data possibly due to servicedatauuid?): omg.log
Filtering out the decoded messages only there still are occasional gaps of around 15 minutes without any servicedata/decoding ☹️
If and why this is happening with your SwitchBot Meter is beyond me, as there are only slight differences with the model printed information above.
Lastly, to account for possible reception issues of your ESP32s - which I don't really think is the problem here - you could also try running Theengs Gateway on your laptop/desktop PC, just to rule out that last possible parameter on the receiving side.
It's running and similar to when I flashed a newly unpacked ESP32 I'm only seeing sensor readings.
At least 1 reading per 10 seconds so far - I'll let it run for a bit.
This should be enough time: every single publications to MQTT contained sensor readings, approximately 16 readings per minute.
So I actually cleared the flash from an ESP and flashed esp32dev-ble (regular) and all BTtoMQTT
topics before I started Theengs and the ESP. This way, I could see them side by side.
top data is esp32dev-ble.
So Theeng received about 16 sensor readings per minute and there wasn't a single manufacturer only reading. The brand spanking newly unpacked ESP was able to see 36 readings in 5 minutes - still less than Theengs but looking at MQTT, we can clearly see the ESP is picking up a lot of stuff - and it's able to decode the Switchbot's data.
DEBUG:BLEGateway:C6:C7:52:66:3C:BF RSSI:-63 AdvertisementData(manufacturer_data={2409: b'\xc6\xc7Rf<\xbf9\x0b\x05\x91K'}, service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': b'i\x80\xe4\x05\x91K'}, rssi=-63)
INFO:BLEGateway:publishing device `{'id': 'C6:C7:52:66:3C:BF', 'rssi': -63, 'brand': 'SwitchBot', 'model': 'Meter (Plus)', 'model_id': 'THX1/W230150X', 'tempc': 17.5, 'tempf': 63.5, 'hum': 75, 'batt': 100}
binary resolved:
manufacturer_data={2409: 'c6c752663cbf390b05914b'}
service_data={'0000fd3d-0000-1000-8000-00805f9b34fb': '6980e405914b'}
The only difference in the manufacturer data is 6909 vs. 2409; presuming the key and value are concatenated.
# from omg
{"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf390b05914b","rssi":-51}
I'm clearly no expert on BLE, OMG, etc. seeing as this process has been my first interaction with both, but is it possible the signal is getting lost/cut off or that the ESP just can't keep up with all the broadcasts going on?
Thanks for this extensive testing, could you try with the last development version, in particular I would like to check if this PR improved BLE reception by decreasing wifi/MQTT usage.
Alternatively, you could try this also and see if you constantly get servicedata and manufacturerdata for the sswitchbot.
Mostly manufacturer only readings
The nimble example gave me a bit of grieve so I figured: let's try ESPHome's esp32_ble_tracker
module.
Default tracker config
[00:07:23.6600] [C][esp32_ble_tracker:787]: BLE Tracker:
[00:07:23.6644] [C][esp32_ble_tracker:788]: Scan Duration: 300 s
[00:07:23.6706] [C][esp32_ble_tracker:789]: Scan Interval: 320.0 ms
[00:07:23.6765] [C][esp32_ble_tracker:790]: Scan Window: 30.0 ms
[00:07:23.6814] [C][esp32_ble_tracker:791]: Scan Type: ACTIVE
[00:07:23.6866] [C][esp32_ble_tracker:792]: Continuous Scanning: True
Excerpt from the serial console:
[00:20:36.0707] [VV][esp32_ble_tracker:575]: Parse Result:
[00:20:36.0753] [VV][esp32_ble_tracker:592]: Address: C6:C7:52:66:3C:BF (RANDOM)
[00:20:36.0823] [VV][esp32_ble_tracker:594]: RSSI: -27
[00:20:36.0877] [VV][esp32_ble_tracker:595]: Name: ''
[00:20:36.0913] [VV][esp32_ble_tracker:603]: Ad Flag: 6
[00:20:36.0963] [VV][esp32_ble_tracker:609]: Manufacturer data: C6.C7.52.66.3C.BF.61.0B.07.91.4A (11)
[00:20:36.1056] [VV][esp32_ble_tracker:620]: Service data:
[00:20:36.1104] [VV][esp32_ble_tracker:621]: UUID: 0xFD3D
[00:20:36.1162] [VV][esp32_ble_tracker:622]: Data: 69.80.E4.07.91.4A (6)
[00:20:36.1213] [VV][esp32_ble_tracker:625]: Adv data: 02.01.06.0E.FF.69.09.C6.C7.52.66.3C.BF.61.0B.07.91.4A.09.16.3D.FD.69.80.E4.07.91.4A (28)
[00:20:36.1334] [D][ble_adv:012]: SwitchBot
[00:20:36.1373] [V][component:199]: Component esp32_ble_tracker took a long time for an operation (0.06 s).
[00:20:36.1463] [V][component:200]: Components should block for at most 20-30ms.
[00:25:31.8750] [VV][esp32_ble_tracker:575]: Parse Result:
[00:25:31.8805] [VV][esp32_ble_tracker:592]: Address: C6:C7:52:66:3C:BF (RANDOM)
[00:25:31.8866] [VV][esp32_ble_tracker:594]: RSSI: -28
[00:25:31.8916] [VV][esp32_ble_tracker:595]: Name: ''
[00:25:31.8967] [VV][esp32_ble_tracker:603]: Ad Flag: 6
[00:25:31.9029] [VV][esp32_ble_tracker:609]: Manufacturer data: C6.C7.52.66.3C.BF.66.0B.03.92.57 (11)
[00:25:31.9096] [VV][esp32_ble_tracker:620]: Service data:
[00:25:31.9145] [VV][esp32_ble_tracker:621]: UUID: 0xFD3D
[00:25:31.9196] [VV][esp32_ble_tracker:622]: Data: 69.80.E4.03.92.57 (6)
[00:25:31.9256] [VV][esp32_ble_tracker:625]: Adv data: 02.01.06.0E.FF.69.09.C6.C7.52.66.3C.BF.66.0B.03.92.57.09.16.3D.FD.69.80.E4.03.92.57 (28)
[00:25:31.9376] [V][component:199]: Component esp32_ble_tracker took a long time for an operation (0.05 s).
[00:25:31.9469] [V][component:200]: Components should block for at most 20-30ms.
[00:25:41.1333] [VV][esp32_ble_tracker:575]: Parse Result:
[00:25:41.1386] [VV][esp32_ble_tracker:592]: Address: C6:C7:52:66:3C:BF (RANDOM)
[00:25:41.1455] [VV][esp32_ble_tracker:594]: RSSI: -23
[00:25:41.1495] [VV][esp32_ble_tracker:595]: Name: ''
[00:25:41.1549] [VV][esp32_ble_tracker:603]: Ad Flag: 6
[00:25:41.1595] [VV][esp32_ble_tracker:609]: Manufacturer data: C6.C7.52.66.3C.BF.68.0B.03.92.50 (11)
[00:25:41.1676] [VV][esp32_ble_tracker:620]: Service data:
[00:25:41.1729] [VV][esp32_ble_tracker:621]: UUID: 0xFD3D
[00:25:41.1777] [VV][esp32_ble_tracker:622]: Data: 69.80.E4.03.92.50 (6)
[00:25:41.1846] [VV][esp32_ble_tracker:625]: Adv data: 02.01.06.0E.FF.69.09.C6.C7.52.66.3C.BF.68.0B.03.92.50.09.16.3D.FD.69.80.E4.03.92.50 (28)
It reads about once a minute w/ service data. The component warning happens after some devices, but not all. Interestingly to note is that the manufacturer data changes whereas with OMG it stays the same, i.e. from one of my omg.log
's
$ jq '.manufacturerdata' ~/omg.log | wc -l
46
$ jq '.manufacturerdata' ~/omg.log | sort -u
"6909c6c752663cbf290b079149"
"6909c6c752663cbf2a0b069149"
So far ESPHome's output is comparable with Theengs, compared the data into ESPHome's dotted format for readability i.e.
~ | manufacturer data |
---|---|
ESPHOME | C6.C7.52.66.3C.BF.68.0B.03.92.50 |
Theengs | C6.C7.52.66.3C.BF.39.0B.05.91.4B |
OMG | 69.09.C6.C7.52.66.3C.BF.2A.0B.06.91.49 |
Why do you think OMG's is prefixed by 69.09 instead of the mac address such as the others?
The nimble example gave me a bit of grieve
Could you elaborate on this?
Why do you think OMG's is prefixed by 69.09 instead of the mac address such as the others?
~I'll look into this.~
EDIT: looked into it, simple explanation is different representation.
manufacturer_data={2409: 'c6c752663cbf390b05914b'}
~= "manufacturerdata":"6909c6c752663cbf210b009249"
6909 in little endian = 0x0969 = 2409 decimal, which represents the manufacturer ID in the BLE manufacturer data type.
OMG simply provides the entire data packet when publishing and does not separate out the ID as the other applications do.
The nimble example gave me a bit of grieve
Could you elaborate on this?
I was in a bit of a rush (had a few moments in between work), so I figured I'd quickly install Arduino's IDE; but found Arduino's web IDE instead. So I imported the library and added the example, but it wouldn't compile. It ran into an issue looking for a config.h file. I figured, I'd look into it a little bit later. So I did, and then it ran into missing FreeRTOS (iirc) and so I added that, but that didn't pan out. So again, I figured I'd look into it a bit later and in the meantime I just flashed ESPHome w/ some config to get some data.
So nimble example gave me a bit of grieve really means I'm still very inexperienced in the ESP* ecosystem and haven't found my way around yet :)
Truth be told, I probably overlooked something obvious; or read over something while it was staring me in the face.
6909 in little endian = 0x0969 = 2409 decimal, which represents the manufacturer ID in the BLE manufacturer data type.
Ah, that makes sense. I'll be giving the nimble example another try - hopefully later today - to see if I can confirm the observations made with ESPHome.
--
I do want to express my gratitude to all of you, and especially @DigiH for all his time and effort, for helping me out and looking into this!
Interestingly to note is that the manufacturer data changes whereas with OMG it stays the same
Not quite the case ;) as with OMG/Decoder the manufacturerdata also changes, as the last 3 bytes do actually contain the temperature and humidity information (no battery). Easily visible when both manufacturerdata and servicedata are present
{"@timestamp":"2022-10-22T20:07:20+02:00","batt":100,"brand":"SwitchBot","hum":74,"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","model":"Meter (Plus)","model_id":"THX1/W230150X","rssi":-33,"servicedata":"6980e409914a","servicedatauuid":"0xfd3d","tempc":17.9,"tempf":64.22}
Unfortunately when it is a manufacturerdata only transmission there is no additional clear identification as with the servicedata's device type and the servicedatauuid to uniquely identify this device to be able to use manufacturerdata only for a clear decoding.
{"@timestamp":"2022-10-22T20:08:51+02:00","id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf160b09914a","rssi":-33}
Here are the logs of the NimBLE example:
[c6:c7:52:66:3c:bf = the switchbot]
[15:09:07.0065] Scanning...
[15:09:07.2946] Advertised Device: Name: HwZ_fb113f1ab1002b1915, Address: 00:a0:50:63:16:55
[15:09:07.3965] Advertised Device: Name: , Address: 64:6f:d4:4f:e1:57, manufacturer data: 4c001005441c8bb550, txPower: 12
[15:09:12.1448] Advertised Device: Name: , Address: f5:e4:04:f9:c7:e8, manufacturer data: 4c0012020003
[15:09:24.4545] Advertised Device: Name: , Address: d4:5d:76:96:ee:4c, manufacturer data: 4c0012020000
[15:09:26.2919] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfc10b01924d
[15:09:26.3007] Service Data:
[15:09:26.3027] UUID: 0xfd3d, Data: i���M
[15:10:07.2678] Advertised Device: Name: HwZ_fb113f1ab1002b1915, Address: 00:a0:50:63:16:55
[15:10:08.1237] Advertised Device: Name: , Address: 64:6f:d4:4f:e1:57, manufacturer data: 4c001005441c8bb550, txPower: 12
[15:10:16.1883] Advertised Device: Name: , Address: f5:e4:04:f9:c7:e8, manufacturer data: 4c0012020003
[15:10:26.4362] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfc10b01924d
[15:10:26.4456] Service Data:
[15:10:26.4465] UUID: 0xfd3d, Data: i���M
[15:11:07.2196] Advertised Device: Name: HwZ_fb113f1ab1002b1915, Address: 00:a0:50:63:16:55
[15:11:12.5512] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfc10b01924d
[15:11:12.5604] Service Data:
[15:11:12.5614] UUID: 0xfd3d, Data: i���M
[15:11:14.6790] Advertised Device: Name: , Address: 64:6f:d4:4f:e1:57, manufacturer data: 4c001005441c8bb550, txPower: 12
[15:11:16.2264] Advertised Device: Name: , Address: f5:e4:04:f9:c7:e8, manufacturer data: 4c0012020003
[15:12:07.1737] Advertised Device: Name: , Address: 64:6f:d4:4f:e1:57, manufacturer data: 4c001005441c8bb550, txPower: 12
[15:12:10.2758] Advertised Device: Name: , Address: f5:e4:04:f9:c7:e8, manufacturer data: 4c0012020003
[15:12:25.1998] Advertised Device: Name: , Address: 58:8e:c6:2a:9a:7f, manufacturer data: 4c0002151ca92e23f0874df7b9a2fd4b716a4bf60084000003
[15:12:30.7349] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfc10b01924d
[15:12:30.7441] Service Data:
[15:12:30.7451] UUID: 0xfd3d, Data: i���M
[15:13:07.1300] Advertised Device: Name: HwZ_fb113f1ab1002b1915, Address: 00:a0:50:63:16:55
[15:13:08.0068] Advertised Device: Name: , Address: 64:6f:d4:4f:e1:57, manufacturer data: 4c001005441c8bb550, txPower: 12
[15:13:08.3238] Advertised Device: Name: , Address: f5:e4:04:f9:c7:e8, manufacturer data: 4c0012020003
[15:13:08.7941] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfc10b01924d
[15:13:08.8030] Service Data:
[15:13:08.8050] UUID: 0xfd3d, Data: i���M
[15:14:07.0962] Advertised Device: Name: HwZ_fb113f1ab1002b1915, Address: 00:a0:50:63:16:55
[15:14:09.6395] Advertised Device: Name: , Address: 64:6f:d4:4f:e1:57, manufacturer data: 4c001005441c8bb550, txPower: 12
[15:14:14.3629] Advertised Device: Name: , Address: f5:e4:04:f9:c7:e8, manufacturer data: 4c0012020003
[15:14:16.9680] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfc10b01924d
[15:14:16.9769] Service Data:
[15:14:16.9789] UUID: 0xfd3d, Data: i���M
The nimble example gave me a bit of grieve
Could you elaborate on this?
@h2zero The problem was either with me and/or the web ide. After installing Arduino's IDE locally, I got the example running in less than 5 minutes flat w/o any fuzz.
So far - BLE-scanner (the nimble example) has only picked up the switchbot with service data. The service data isn't very readable, so I'll try to adjust that to something more readable for us. At the very least, it does appear (as suggested by Theengs GW and ESPHome) there are no readings without service data.
I'm also going to flash an ESP with OMG-BLE-CONT and log the output of that. Presumably, at some point it'll randomly pick up a sensor reading; and we'll be able to compare its reading w/ the output from BLE-scanner.
[edit]
Modified the nimble example to filter on the MAC of the switchbot + decode the service data. I'm not a hero in these languages but I'm hopeful I did it correctly: https://gist.github.com/xanderificnl/c264238e4318f6462c6db1f83559f563
Here's an example of output (decode values are prefixed with '>>'):
[18:40:38.1801] [switchbot] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfe00b01924d
[18:40:38.1904] Service Data:
[18:40:38.1914] UUID: 0xfd3d, Data: i���M
[18:40:38.1943] >> 6980e401924d
[18:41:48.3144] [switchbot] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfe00b01924d
[18:41:48.3251] Service Data:
[18:41:48.3262] UUID: 0xfd3d, Data: i���M
[18:41:48.3281] >> 6980e401924d
[18:41:50.9557] Advertised Device: Name: , Address: ef:b8:c4:77:64:e8, manufacturer data: 4c0012020003
[18:42:25.7317] Advertised Device: Name: , Address: 72:5e:d0:eb:ee:76, manufacturer data: 4c0002151ca92e23f0874df7b9a2fd4b716a4bf6008d000003
[18:42:44.1366] Advertised Device: Name: , Address: d4:e7:a5:87:5b:ba, manufacturer data: 4c0012020003
[18:42:59.7265] [switchbot] Advertised Device: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfe00b01924d
[18:42:59.7370] Service Data:
[18:42:59.7380] UUID: 0xfd3d, Data: i��
[18:42:59.7400] >> 6980e400924d
Let me try to run it on my side with my switchbot, and share what I see
I tried in my side with different versions of NimBLEArduino and the sketch below but got constant reporting of servicedata.
Could you try this sketch please with NimBLEArduino v1.3.8 and share your logs:
/** Example of continuous scanning for BLE advertisements.
* This example will scan forever while consuming as few resources as possible
* and report all advertisments on the serial monitor.
*
* Created: on January 31 2021
* Author: H2zero
*
*/
#include "NimBLEDevice.h"
NimBLEScan* pBLEScan;
std::string convertServiceData(std::string deviceServiceData) {
int serviceDataLength = (int)deviceServiceData.length();
char spr[2 * serviceDataLength + 1];
for (int i = 0; i < serviceDataLength; i++) sprintf(spr + 2 * i, "%.2x", (unsigned char)deviceServiceData[i]);
spr[2 * serviceDataLength] = 0;
return spr;
}
class MyAdvertisedDeviceCallbacks: public NimBLEAdvertisedDeviceCallbacks {
void onResult(NimBLEAdvertisedDevice* advertisedDevice) {
Serial.println("-----------------------------------------------------------------------------------");
Serial.printf("Advertised Device mac: %s \n", advertisedDevice->getAddress().toString().c_str());
Serial.printf("Advertised Device name: %s \n", (char*)advertisedDevice->getName().c_str());
if (advertisedDevice->haveManufacturerData()) {
char* manufacturerdata = BLEUtils::buildHexData(NULL, (uint8_t*)advertisedDevice->getManufacturerData().data(), advertisedDevice->getManufacturerData().length());
Serial.printf("Advertised Device manufacturer data: %s \n", manufacturerdata);
free(manufacturerdata);
}
if (advertisedDevice->haveServiceData()) {
int serviceDataCount = advertisedDevice->getServiceDataCount();
Serial.printf("Get services data number: %d \n", serviceDataCount);
for (int j = 0; j < serviceDataCount; j++) {
std::string service_data = convertServiceData(advertisedDevice->getServiceData(j));
Serial.printf("Service data: %s \n", service_data.c_str());
std::string serviceDatauuid = advertisedDevice->getServiceDataUUID(j).toString();
Serial.printf("Service data UUID: %s \n", (char*)serviceDatauuid.c_str());
}
}
}
};
void setup() {
Serial.begin(115200);
Serial.println("Scanning...");
/** *Optional* Sets the filtering mode used by the scanner in the BLE controller.
*
* Can be one of:
* CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE (0) (default)
* Filter by device address only, advertisements from the same address will be reported only once.
*
* CONFIG_BTDM_SCAN_DUPL_TYPE_DATA (1)
* Filter by data only, advertisements with the same data will only be reported once,
* even from different addresses.
*
* CONFIG_BTDM_SCAN_DUPL_TYPE_DATA_DEVICE (2)
* Filter by address and data, advertisements from the same address will be reported only once,
* except if the data in the advertisement has changed, then it will be reported again.
*
* Can only be used BEFORE calling NimBLEDevice::init.
*/
NimBLEDevice::setScanFilterMode(CONFIG_BTDM_SCAN_DUPL_TYPE_DEVICE);
/** *Optional* Sets the scan filter cache size in the BLE controller.
* When the number of duplicate advertisements seen by the controller
* reaches this value it will clear the cache and start reporting previously
* seen devices. The larger this number, the longer time between repeated
* device reports. Range 10 - 1000. (default 20)
*
* Can only be used BEFORE calling NimBLEDevice::init.
*/
NimBLEDevice::setScanDuplicateCacheSize(200);
NimBLEDevice::init("");
pBLEScan = NimBLEDevice::getScan(); //create new scan
// Set the callback for when devices are discovered, no duplicates.
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks(), false);
pBLEScan->setActiveScan(true); // Set active scanning, this will get more data from the advertiser.
pBLEScan->setInterval(97); // How often the scan occurs / switches channels; in milliseconds,
pBLEScan->setWindow(37); // How long to scan during the interval; in milliseconds.
pBLEScan->setMaxResults(0); // do not store the scan results, use callback only.
}
void loop() {
// If an error occurs that stops the scan, it will be restarted here.
if(pBLEScan->isScanning() == false) {
// Start scan with: duration = 0 seconds(forever), no scan end callback, not a continuation of a previous scan.
pBLEScan->start(0, nullptr, false);
}
delay(2000);
}
Attached is the log.
Notably, the switchbot got picked up with the service data a total of 113 times. Somehow, only OMG is picking up manufacturer-only data on various ESP32s. So why is OMG seeing manufacturer only data and nothing else is?
I've run 3 different nimble continuous scanners (the default, yours and mine), ESPHome and Theengs Gateway (on my laptop).
Can we get OMG to dump what it sees to serial before it starts processing it?
Thanks for sharing this, we can see that the servicedata is retrieved constantly when focusing on the library functions only.
Can we get OMG to dump what it sees to serial before it starts processing it?
Yes you would need to set the debug log level to LOG_LEVEL_TRACE
here
Or add this into your pio env build_flags
:
'-DLOG_LEVEL=LOG_LEVEL_TRACE'
Cheers, thanks!
You can skip forward to [interesting bit] below.
The final tally of the library functions: 289 broadcasts - all including service data.
Steps:
Full config:
[platformio]
default_envs =
esp32dev-ble-cont
;esp32 cnt
[env:esp32dev-ble-cont]
platform = ${com.esp32_platform}
board = esp32dev
board_build.partitions = min_spiffs.csv
lib_deps =
${com-esp.lib_deps}
${libraries.wifimanager32}
${libraries.ble}
${libraries.decoder}
build_flags =
${com-esp.build_flags}
'-DZgatewayBT="BT"'
'-DLED_SEND_RECEIVE=2'
'-DLED_SEND_RECEIVE_ON=0'
'-DGateway_Name="kfwnlnfkwl"'
'-DAttemptBLEConnect=false'
'-DMQTT_SERVER="172.16.32.2"'
'-Dwifi_ssid="XiFi"'
'-Dwifi_password="-snip-"'
'-DESPWifiManualSetup=true'
'-DLOG_LEVEL=LOG_LEVEL_TRACE'
upload_port = /dev/ttyUSB0
serial.log <-- LOG before my edit
After not seeing anything standing out, I modified ZgatewayBT.ino
to include:
Log.trace(F("%s" CR), advertisedDevice->toString().c_str());
Which yielded the familiar: T: Name: , Address: c6:c7:52:66:3c:bf, manufacturer data: 6909c6c752663cbfa00f029243
// config_BT.h
#ifndef Scan_duration
-# define Scan_duration 10000 //define the time for a scan
+# define Scan_duration 0 //define the time for a scan
#endif
#ifndef BLEScanInterval
-# define BLEScanInterval 52 // How often the scan occurs / switches channels; in milliseconds,
+# define BLEScanInterval 97 // How often the scan occurs / switches channels; in milliseconds,
#endif
#ifndef BLEScanWindow
-# define BLEScanWindow 30 // How long to scan during the interval; in milliseconds.
+# define BLEScanWindow 37 // How long to scan during the interval; in milliseconds.
and this starts to happen:
[02:07:38.0405] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-48,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":66,"batt":100}
[02:08:14.4896] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-49,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
[02:09:48.7264] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-48,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
- 02:10 nothing.
[02:11:42.9423] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-48,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
[02:12:31.0727] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-55,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
[02:13:35.2240] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-55,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
- 02:14 nothing
- 02:15 nothing
[02:16:23.5750] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-50,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
- 02:17 nothing
[02:18:34.5287] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-47,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
- 02:19
[02:20:44.8493] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-54,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
- 02:21
[02:22:49.1084] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-49,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
[02:23:29.1938] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-48,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":18.5,"tempf":65.3,"hum":65,"batt":100}
and I'm starting to see this (previously unseen):
[02:24:25.4183] T: Device mac C6:C7:52:66:3C:BF
[02:24:25.4212] T: Device already discovered or that doesn't require discovery C6:C7:52:66:3C:BF
-truncated-
[02:29:10.5493] N: Device detected: C6:C7:52:66:3C:BF
[02:29:10.5533] T: getDeviceByMac C6:C7:52:66:3C:BF
[02:29:10.5923] T: getDeviceByMac C6:C7:52:66:3C:BF
[02:29:10.5953] T: update C6:C7:52:66:3C:BF
At this point, restarting the ESP may result in the Switchbot being seen or not at all (missing the window permanently, it seems). What's strange is that Theengs' Gateway was about to get 16 readings per minute from the Switchbot [via my laptop].
So I'll:
Any advice and suggestions are appreciated.
I think it is progressing well, thanks to your thorough testing.
If you could try OMG only with this modification:
+# define Scan_duration 0 //define the time for a scan
It would enable pinpointing the continuous scan versus the windows/interval modification as a potential cause.
So I git reset'd
and cleaned flash, etc... all the usual steps.
$ tail -f ~/serial.log | grep 'Send on /BTtoMQTT/C6C752663CBF msg' --text
[19:06:36.8231] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:07:20.7559] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:08:04.8407] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:08:58.9555] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:09:55.0747] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:10:59.2287] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:11:17.2785] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:12:15.4207] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:12:55.5311] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:13:35.6211] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:14:21.7341] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:15:13.8228] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:15:56.6092] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:17:20.7737] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:17:50.8383] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:18:22.9103] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:19:07.0096] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:19:59.1179] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:20:59.2501] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:21:27.3194] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:22:19.4526] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:23:11.5887] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:23:57.6940] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:24:35.7754] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:25:25.5042] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:26:10.6404] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:26:56.7396] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:27:44.8513] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:28:32.9657] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:29:17.0707] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:30:15.2065] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-22,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:31:23.3740] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:31:43.4112] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:32:29.5253] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:33:15.6246] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:34:15.7493] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:34:55.8437] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:35:56.5946] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:36:24.6657] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:38:12.9177] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:39:09.0419] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:39:39.1083] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:40:29.2269] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:41:11.3115] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:42:23.4485] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:43:03.5479] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:43:29.6018] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:44:17.7321] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:45:01.8140] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:45:48.5702] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:46:38.6787] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:47:58.8710] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:48:10.9084] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:49:07.0251] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-20,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:49:47.1149] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:50:49.2682] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:51:21.3250] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:52:15.4302] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:52:55.5138] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
*19:53 missing*
[19:54:07.6674] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:54:35.7314] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:55:24.6560] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:56:08.6321] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:57:08.7700] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:57:54.8812] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:58:24.9606] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[19:59:13.0880] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:00:03.2117] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:00:59.3281] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:01:41.4549] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:02:27.5781] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:03:07.6755] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:04:07.8224] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:04:47.9298] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:05:36.5333] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-23,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
[20:06:18.6470] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":17.6,"tempf":63.68,"hum":63,"batt":100}
so as far as I can see, it missed one beat at 19:53 which isn't very interesting on its own.
Cool, seems Scan_duration 0
solve your issue. This could make us reconsider the existing parameters of esp32dev-ble-cont.
But doesn't explain why we have missing service data with esp32dev-ble
Running with the default esp32dev-ble at the moment with trace on.
One thing that stands out is that good readings are processed before the scan ends, and readings without service data are processed after the scan ends. Is it possible that OMG is freeing the data before it's retrieved?
Here's a clean reading for reference:
[05:13:25.3536] N: Scan begin
[05:13:27.3417] T: Creating BLE buffer
[05:13:27.3443] N: Device detected: 52:37:AE:7D:14:92
[05:13:27.3473] T: getDeviceByMac 52:37:AE:7D:14:92
[05:13:27.3853] T: No device found
[05:13:27.3873] N: Send on /BTtoMQTT/5237AE7D1492 msg {"id":"52:37:AE:7D:14:92","mac_type":1,"manufacturerdata":"4c0010050a1c557eb6","rssi":-86,"txpower":12}
[05:13:27.4003] T: jsonPubl - ON
[05:13:27.4013] T: [ OMG->MQTT ] topic: home/esp32-dev-ble-fkenwlnflwe/BTtoMQTT/5237AE7D1492 msg: {"id":"52:37:AE:7D:14:92","mac_type":1,"manufacturerdata":"4c0010050a1c557eb6","rssi":-86,"txpower":12}
[05:13:31.1258] T: Creating BLE buffer
[05:13:31.1277] N: Device detected: C6:C7:52:66:3C:BF
[05:13:31.1317] T: getDeviceByMac C6:C7:52:66:3C:BF
[05:13:31.1348] T: Get services data number: 1
[05:13:31.1377] T: Converted service data (6) to 69c0e406903f
[05:13:31.1417] T: Service data: 69c0e406903f
[05:13:31.1437] T: Service data UUID: 0xfd3d
[05:13:31.1668] T: Decoder found device: THX1/W230150X
[05:13:31.1708] T: getDeviceByMac C6:C7:52:66:3C:BF
[05:13:31.1737] T: update C6:C7:52:66:3C:BF
[05:13:31.1757] T: Removing servicedatauuid
[05:13:31.1787] T: Removing servicedata
[05:13:31.1807] T: Removing manufacturerdata
[05:13:31.1828] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":16.6,"tempf":61.88,"hum":63,"batt":100}
[05:13:31.2007] T: jsonPubl - ON
[05:13:31.2029] T: [ OMG->MQTT ] topic: home/esp32-dev-ble-fkenwlnflwe/BTtoMQTT/C6C752663CBF msg: {"id":"C6:C7:52:66:3C:BF","mac_type":1,"rssi":-25,"brand":"SwitchBot","model":"Meter (Plus)","model_id":"THX1/W230150X","tempc":16.6,"tempf":61.88,"hum":63,"batt":100}
[05:13:32.0078] T: Creating BLE buffer
[05:13:32.0098] N: Device detected: 52:37:AE:7D:14:92
[05:13:32.0138] T: getDeviceByMac 52:37:AE:7D:14:92
[05:13:32.0519] T: No device found
[05:13:32.0538] N: Send on /BTtoMQTT/5237AE7D1492 msg {"id":"52:37:AE:7D:14:92","mac_type":1,"manufacturerdata":"4c0010050a1c557eb6","rssi":-86,"txpower":12}
[05:13:32.0658] T: jsonPubl - ON
[05:13:32.0678] T: [ OMG->MQTT ] topic: home/esp32-dev-ble-fkenwlnflwe/BTtoMQTT/5237AE7D1492 msg: {"id":"52:37:AE:7D:14:92","mac_type":1,"manufacturerdata":"4c0010050a1c557eb6","rssi":-86,"txpower":12}
[05:13:35.3618] N: Found 2 devices, scan number 24 end
[05:13:35.3652] T: Process BLE stack free: 3068
[05:13:35.3682] T: macAdr C6:C7:52:66:3C:BF
[05:13:35.3702] T: macType 1
[05:13:35.3712] T: isDisc 1
[05:13:35.3722] T: isWhtL 0
[05:13:35.3732] T: isBlkL 0
[05:13:35.3752] T: connect 0
[05:13:35.3762] T: sensorModel_id 39
[05:13:35.3772] T: macAdr 6D:50:C9:F8:3B:43
[05:13:35.3802] T: macType 1
[05:13:35.3812] T: isDisc 0
[05:13:35.3822] T: isWhtL 0
[05:13:35.3832] T: isBlkL 0
[05:13:35.3842] T: connect 0
[05:13:35.3852] T: sensorModel_id 55
[05:14:16.6461] T: retrieving value of system characteristics Uptime (s):1569
Here's a bad reading. Ever since starting to look into this problem, I've seen garbled serial output, and I assumed it was simply the serial connection. Yet, as far as I can tell, proper readings are outputted nice and tidy and bad readings are generally accompanied by garbled output.
Scan begins [05:16:42.1104] N: Scan begin
[05:16:43.1864] T: Creating BLE buffer
[05:16:43.1884] N: Device detected: DF:AE:6F:EF:AA:86
[05:16:43.1924] T: getDeviceByMac DF:AE:6F:EF:AA:86
[05:16:43.2304] T: No device found
[05:16:43.2324] N: Send on /BTtoMQTT/DFAE6FEFAA86 msg {"id":"DF:AE:6F:EF:AA:86","mac_type":1,"manufacturerdata":"4c0012020003","rssi":-56}
[05:16:43.2434] T: jsonPubl - ON
[05:16:43.2444] T: [ OMG->MQTT ] topic: home/esp32-dev-ble-fkenwlnflwe/BTtoMQTT/DFAE6FEFAA86 msg: {"id":"DF:AE:6F:EF:AA:86","mac_type":1,"manufacturerdata":"4c0012020003","rssi":-56}
[05:16:48.4070] T: Creating BLE buffer
[05:16:48.4090] N: Device detected: 7F:14:32:27:45:54
[05:16:48.4130] T: getDeviceByMac 7F:14:32:27:45:54
[05:16:48.4510] T: No device found
[05:16:48.4530] N: Send on /BTtoMQTT/7F1432274554 msg {"id":"7F:14:32:27:45:54","mac_type":1,"manufacturerdata":"4c001005021c03f543","rssi":-86,"txpower":12}
[05:16:48.4659] T: jsonPubl - ON
[05:16:48.4670] T: [ OMG->MQTT ] topic: home/esp32-dev-ble-fkenwlnflwe/BTtoMQTT/7F1432274554 msg: {"id":"7F:14:32:27:45:54","mac_type":1,"manufacturerdata":"4c001005021c03f543","rssi":-86,"txpower":12}
[05:16:52.1188] T: Creating BLE buffer
Scan ends: [05:16:52.1214] N: Found 4 devices, scan number 27 end
First Switchbot mention [05:16:52.1244] N: Device detected: C6:C7:52:66:3C:BF
Garbled (T:) [05:16:52.1274] T: getDeT: viceByMac C6:C7:52:66:3C:BF
Garbled (T:) [05:16:52.1314] Process BLE stack free: 3068
[05:16:52.1336] T: macAdr C6:C7:52:66:3C:BF
[05:16:52.1364] T: macType 1
[05:16:52.1376] T: isDisc 1
[05:16:52.1384] T: isWhtL 0
[05:16:52.1394] T: isBlkL 0
[05:16:52.1404] T: connect 0
[05:16:52.1414] T: sensorModel_id 39
[05:16:52.1434] T: macAdr 6D:50:C9:F8:3B:43
[05:16:52.1454] T: macType 1
[05:16:52.1464] T: isDisc 0
[05:16:52.1483] T: isWhtL 0
[05:16:52.1494] T: isBlkL 0
[05:16:52.1504] T: connect 0
[05:16:52.1514] T: sensorModel_id 55
[05:16:52.1634] T: No device found
[05:16:52.1654] T: Creating BLE buffer
[05:16:52.1675] N: Device detected: 3C:91:80:C9:28:58
[05:16:52.1714] T: getDeviceByMac 3C:91:80:C9:28:58
[05:16:52.1745] T: No device found
Sensorless reading [05:16:52.1754] N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf970f07903f","rssi":-24}
[05:17:47.6972] N: Scan begin
Very interesting from the log:
[90m[23:15:56.0996][0m N: Scan begin
[90m[23:16:06.1060][0m T: Creating BLE buffer
[90m[23:16:06.1086][0m N: Found 5 devices, scan number N: D7evice detected: C6:C7:52:66:3C:BF
[90m[23:16:06.1146][0m end
[90m[23:16:06.1146][0m T: getDeviceByMac C6:C7:52:66:3C:BF
[90m[23:16:06.1176][0m T: Process BLE stack free: 3068
Looks like the switchbot was only just detected as the scan ended and results in missing data. What I suspect is going on is that the switchbot advertisement was detected but no scan response had been received when the scan ended. When this occurs NimBLE will invoke the callback with whatever data it does have, complete or not, which in this case it was not.
Since the device advertises about every 10 seconds, I would adjust the scan duration to 15 seconds to allow more time to get the scan response data.
Currently running w/ '-DScan_duration=15000'
Results in:
[19:59:32.7484] T: Creating BLE buffer
[19:59:32.7504] N: Device detected: C6:C7:52:66:3C:BF
[19:59:32.7534] T: getDeviceByMac C6:C7:52:66:3C:BF
[19:59:32.7573] N: Found 6 devices, scan number 1 end
[19:59:32.7603] T: Process BLE stack free: 3068
[19:59:32.7633] N: BLE Connect begin
[19:59:32.7643] N: BLE Connect end
[19:59:32.7938] T: No device found
I am fairly sure the Switchbot advertises a bit more than once per 10 seconds. Theengs' Gateway on my laptop picked up 16 sensor readings a minute, so that's about once per 3-4 seconds.
Theengs' readings for reference:
Ran with python3 -m TheengsGateway -H 172.16.32.2 --log_level=DEBUG 2>&1 | tee >(ts "%H:%M:%S" > theengs.log)
20:05:37 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:05:39 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:05:47 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -35, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:05:49 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -35, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:05:51 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -35, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:05:57 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -31, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:05:59 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -31, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:01 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -31, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:09 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:11 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:19 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -34, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:21 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -34, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:29 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:31 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:33 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -36, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:39 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -32, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
20:06:41 INFO:BLEGateway:Sent `{"id": "C6:C7:52:66:3C:BF", "rssi": -32, "brand": "SwitchBot", "model": "Meter (Plus)", "model_id": "THX1/W230150X", "tempc": 16.5, "tempf": 61.7, "hum": 67, "batt": 100}` to topic `home/TheengsGateway/BTtoMQTT/C6C752663CBF`
Thanks for that, could you try one more thing? I'm curious what happens if you set the scan duration to 6 seconds instead. It's possible that this is caused by NimBLE when seeing the device multiple times during the scan.
Scan_duration to 6000
Results:
[20:14:57.9009] N: Found 3 devices, scan number 1 end
[20:14:57.9049] N: Device detected: 64:F6:5B:4E:54:2B
[20:14:57.9079] T: getDevT: Process BLE stack freie: ceByMac 64:F6:5B:4E:54:2B
[20:14:57.9129] 3068
[20:14:57.9139] N: BLE Connect begin
[20:14:57.9159] N: BLE Connect end
[20:14:57.9459] T: No device found
[20:14:57.9478] T: Creating BLE buffer
[20:14:57.9499] N: Device detected: C6:C7:52:66:3C:BF
[20:14:57.9529] T: getDeviceByMac C6:C7:52:66:3C:BF
[20:14:57.9894] T: No device found
With 2 seconds:
[20:16:45.2162] T: Creating BLE buffer
[20:16:45.2187] N: Found 3 devices, scan number 1 end
[20:16:45.2217] N: Device detected: 64:F6:5B:4E:54:2B
[20:16:45.2247] T: getDeviceByMac 64:F6:5B:4E:54:2B
[20:16:45.2287] T: Process BLE stack free: 3068
[20:16:45.2308] N: BLE Connect begin
[20:16:45.2327] N: BLE Connect end
[20:16:45.2607] T: No device found
[20:16:45.2628] T: Creating BLE buffer
[20:16:45.2647] N: Device detected: C6:C7:52:66:3C:BF
[20:16:45.2688] T: getDeviceByMac C6:C7:52:66:3C:BF
[20:16:45.3052] T: No device found
FWIW, a comparison of OMG & Theengs from MQTT:
Hmm, not really what I expected but here is a NimBLE branch to try: https://github.com/h2zero/NimBLE-Arduino/tree/adv-data-fix
N: Scan begin N: Send on /BTtoMQTT/C6C752663CBF msg {"id":"C6:C7:52:66:3C:BF","mac_type":1,"manufacturerdata":"6909c6c752663cbf850f049243","rssi":-63} N: Found 0 devices, scan number 61 end N: Scan begin N: Found 1 devices, scan number N62 en: d Device detected: C6:C7:52:66:3C:BF
Describe the bug OpenMQTTGateway isn't recognizing my Switchbot Meter Plus properly.
To Reproduce
Expected behavior For it to recognize my Switchbot Meter Plus.
Environment (please complete the following information):
latest versions
Additional context
Pinging @DigiH / issue #20
The switchbot is C6:C7:52:66:3C:BF
In essense the monitor just says this:
and when I press the bluetooth button on the meter:
On MQTT: