nymare
(Marko B)
October 24, 2022, 12:20pm
1
Hi all,
this is a continuation of ESP32-C3 deplyoment: ESP32-C3 Bluetooth Proxy invalid header: 0xffffffff - #3 by nymare
BLE-Proxy seems to work (see logs below), but i don’t get any new devices Discovered .
Maybe i need to Discover devices via standard BLE and then only use Proxy to communicate with them later on? Two thermometers i’ve Discovered via standard BLE now work flawlessly via BLE Proxy. I did delete original LWMMM… BLE Discovered device integrations before they were flashed.
Let me share some more findings. I am using only this in ESPHome (removed BLE Tracker):
bluetooth_proxy:
active: true
I will try to add ATC thermometers i’ve flashed manually.
Flashing link: Telink Flasher
ESPHome ATC Thermometer sensor instructions: Xiaomi Mijia BLE Sensors — ESPHome
Verbose logs show ATC is visible, but does not popup as Discovered in HomeAssistant:
[13:44:15][C][logger:275]: Logger:
[13:44:15][C][logger:276]: Level: VERBOSE
[13:44:15][C][logger:277]: Log Baud Rate: 115200
[13:44:15][C][logger:278]: Hardware UART: UART0
[13:44:15][C][esp32_ble_tracker:793]: BLE Tracker:
[13:44:15][C][esp32_ble_tracker:794]: Scan Duration: 300 s
[13:44:15][C][esp32_ble_tracker:795]: Scan Interval: 320.0 ms
[13:44:15][C][esp32_ble_tracker:796]: Scan Window: 30.0 ms
[13:44:15][C][esp32_ble_tracker:797]: Scan Type: ACTIVE
[13:44:15][C][esp32_ble_tracker:798]: Continuous Scanning: True
[13:44:15][C][bluetooth_proxy:167]: Bluetooth Proxy:
[13:44:15][C][mdns:100]: mDNS:
[13:44:15][C][mdns:101]: Hostname: esp32ble-proxy1
[13:44:15][V][mdns:102]: Services:
[13:44:15][V][mdns:104]: - _esphomelib, _tcp, 6053
[13:44:15][V][mdns:106]: TXT: version = 2022.10.0
[13:44:15][V][mdns:106]: TXT: mac = 34b4724fxxx
[13:44:15][V][mdns:106]: TXT: platform = ESP32
[13:44:15][V][mdns:106]: TXT: board = esp32-c3-devkitm-1
[13:44:15][V][mdns:106]: TXT: network = wifi
[13:44:15][C][ota:089]: Over-The-Air Updates:
[13:44:15][C][ota:090]: Address: 192.xxxxx:3232
[13:44:15][C][ota:093]: Using Password.
[13:44:15][C][api:138]: API Server:
[13:44:15][C][api:139]: Address: 192.xxxxx:6053
[13:44:15][C][api:143]: Using noise encryption: NO
[13:44:16][V][bluetooth_proxy:026]: Proxying packet from - 41:8B:88:XXXXX RSSI: -74 dB
[13:44:23][V][bluetooth_proxy:026]: Proxying packet from - 41:8B:88:XXXX. RSSI: -83 dB
[13:44:23][V][bluetooth_proxy:026]: Proxying packet from ATC_FC9B19 - XXXX:FC:9B:19. RSSI: -54 dB
[13:44:24][V][bluetooth_proxy:026]: Proxying packet from - 53:14:CD:XXXX. RSSI: -38 dB
[13:44:24][V][bluetooth_proxy:026]: Proxying packet from - 2F:E2:EC:XXXX. RSSI: -29 dB
[13:44:24][V][bluetooth_proxy:026]: Proxying packet from - 63:EF:93:XXXX. RSSI: -52 dB
[13:44:26][V][bluetooth_proxy:026]: Proxying packet from - 53:14:CD:XXXXX. RSSI: -36 dB
[13:44:31][V][bluetooth_proxy:026]: Proxying packet from ATC_28195B - XXX:19:5B. RSSI: -69 dB
nikito7
(nikito7)
October 24, 2022, 12:58pm
2
I only use Proxies. Maybe C3 issues
You need ad BTHome or xiaomi ble integration. If not autodiscovered
nymare
(Marko B)
October 25, 2022, 1:51pm
3
Thanks Nikito7, your pointers were good.
I already had XIAOMI BLE, but it did not find any thermometers. I then focused on your BTHome advice and that worked.
For anyone else who needs help, this are the steps:
Still not sure why Xiaomi BLE worked originally for first two flashed thermometers, but i don’t care as BTHome works well.
1 Like
lorcott
(Scott)
October 25, 2022, 3:06pm
4
My BLE found my thermometer. It shows as entities in ESPHOME but the results read “UNKNOWN”.
nymare
(Marko B)
October 25, 2022, 4:03pm
5
Scott, you mean you only get 1 entity? As this is what i got when i had FW that could push BLE out, but HomeAssistant was not able to read data. Changing FW setting to supported communication adds new entities.
In case you get entities, but not updated it means it is not receiving the device BLE messages.
Do you use BLE Proxy? As one useful feature is Verbose logging
lorcott
(Scott)
October 25, 2022, 5:12pm
6
I setup via ESPHOME. What is FW?
nymare
(Marko B)
October 25, 2022, 5:41pm
7
I thought you have Xiaomi thermometer and then need to upload custom FW: Esphome Tutorial: for 4$ monitor your home temperature with esp32 and xiaomi mijia ·
Can you share your ESPHome code? As it looks like you don have BLE, but ESP32 based thermomether.
lorcott
(Scott)
October 25, 2022, 8:14pm
8
esphome:
name: esphome-web-a2fff4
esp32_ble_tracker:
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
sensor:
- platform: atc_mithermometer
mac_address: "A4:C1:38:B1:CD:7F"
temperature:
name: "A Temperature"
humidity:
name: "A Humidity"
battery_level:
name: "A Battery-Level"
battery_voltage:
name: "A Battery-Voltage"
signal_strength:
name: "A Signal"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-A2Fff4"
password: "MVXZrCGYTf5A"
captive_portal:
nikito7
(nikito7)
October 25, 2022, 11:22pm
10
Bluetooth Proxy
esp32_ble_tracker:
scan_parameters:
active: true
bluetooth_proxy:
lorcott
(Scott)
October 25, 2022, 11:40pm
11
I added the code…nothing changed.
esp32_ble_tracker:
scan_parameters:
active: true
bluetooth_proxy:
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
sensor:
- platform: atc_mithermometer
mac_address: "A4:C1:38:B1:CD:7F"
temperature:
name: "A Temperature"
humidity:
name: "A Humidity"
battery_level:
name: "A Battery-Level"
battery_voltage:
name: "A Battery-Voltage"
signal_strength:
name: "A Signal"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-A2Fff4"
password: "MVXZrCGYTf5A"
captive_portal:
lorcott
(Scott)
October 25, 2022, 11:45pm
13
I have stats but no temp or humidity
nikito7
(nikito7)
October 25, 2022, 11:53pm
14
see pvvx stuff above.
Only work with Mi adv ou BThome adverts type
Blacky
October 26, 2022, 11:05am
16
@lorcott Just wait it takes some time to load.
@nikito7 BTHome has a lot decimal points. I don’t like BTHome because of that, and rather use the xiaomi or the Mijia advertising. I have 13 sensors all working well and battery life is good (over 1 year)
I also disable the voltage as it not required and it is just more data
1 Like
lorcott
(Scott)
October 26, 2022, 12:37pm
17
thx…now when I’m ready to add another thermo, do I need to change the MAC address in ESPHOME? FYI I just copied that MAC address from a setup sample so I don’t know where it points.
nikito7
(nikito7)
October 26, 2022, 12:44pm
18
You just need Bluetooth proxy
lorcott
(Scott)
October 26, 2022, 1:55pm
19
currently my ESPHOME has
esp32_ble_tracker:
scan_parameters:
active: true
bluetooth_proxy:
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
sensor:
- platform: atc_mithermometer
mac_address: "A4:C1:38:B1:CD:7F"
temperature:
name: "A Temperature"
Do I not need the other stuff???
nikito7
(nikito7)
October 26, 2022, 2:31pm
20
You dont need:
sensor:
- platform: atc_mithermometer
After only in HA