3 active connections! Theres a difference between active and passive. You can have many more passive than 3. You could really do more than 3 active connections too… Use a script to put connection/sensor update in a delayed sequence 1 after the other or 2 at a time then disconnect, do another set, repeat.
“these specific units” you mean meters? No.
With ble_tracker you are just scanning advertising, then looking for either service data or manufacturer data.
I Have only one unit per manufacturer, so I just filter with manufacturer_id but in your case you have to put mac address as well.
esp32_ble_tracker:
id: ble_tracker
scan_parameters:
continuous: false
active: false
interval: 120ms
window: 30ms
on_ble_manufacturer_data_advertise:
- manufacturer_id: '0969'
then:
- lambda: |-
float humidity = x[10] & 0x7F;
float temp = (x[8] & 0x0F) * 0.1 + (x[9] & 0x7F);
if ((x[9] & 0x80) == 0){
temp = -temp;
}
id(switchbot_humidity).publish_state(humidity);
id(switchbot_temperature).publish_state(temp);
You can play with parameters or just leave them default. Notice that in my code I don’t do continuous scanning, because I have a lot of other things going on and BLE is quite resource hungry…
time:
- platform: sntp
id: sntp_time
timezone: Europe/Rome
on_time:
- seconds: 0
minutes: 0/10
then:
- esp32_ble_tracker.start_scan:
- seconds: 50
minutes: 0/10
then:
- esp32_ble_tracker.stop_scan:
Funny enough to mention, I have difficulties to reach my Govee thermometer behind one light wall but I find my neighbors Xiaomi toothbrush…
Thank you so much. I appreciate the pointers.
I got this working as shown, thank you
One weird question that might just be my being a beginner. The sensors appear to be of a generic type or class when that occurs. E.g. when I try to use them in a climate related dashboard card (e.g. ‘Comfortable Environment Card’) they don’t appear in the selection list where my other sensor (from a Dyson Hot and Cool air purifier does). Is there a way to set an attribute on those sensors that makes them specifically a humidity or temperature sensor?
…Aaaand we have bad news: although this works, it burns through the batteries in less than a week, which is excessive by any standards. At first I was hoping that the units were merely shipped with dud batteries, as all of them died within a few days. But then fresh batteries did not last any longer, in any of them, which clearly shows that actively and continuously communicating is a very bad idea. Another identical unit which is not communicated with still happily runs almost a month later on its original battery.
It is not obvious (to me, at least, which is not saying much) how one could tone down the ferocity of the communication, and/or cycle between more than three units on a timed cycle, as suggested.
If you use passive ble_tracker, there is no pairing and sensor doesn’t even know it’s been listened…
I realise that, but sadly I have been unable to make this work as of yet. As a stopgap measure I have acquired some Xiaomi Mi units, and by following in the steps of others (including using Telink Flasher v7.9) I have succeeded in getting Tasmota to monitor them (passively) without a hiccup. And yes, I reverted to Tasmota.
Each time I dabble with ESPHome I am struck by how elaborate (and slow) the process is, and fraught with incessant updates, while with Tasmota one simply loads and configures, and that is the end of it, for as long as one chooses. Very rarely do I feel the need to update a Tasmotised unit once it is up and running, despite the fact that I tend to make each device do many things - it has to earn its keep in my home. For example the Sonoff Basic in the garage monitors three I2C thermometers (freezer, fridge, and ambient), reads a Hall sensor to detect the door into the kitchen opening, and almost as an afterthought also controls a light, using the original onboard relay. Never needs to be updated, either, and it never nags me.
But we digress once more.
So the immediate crisis has been averted (by throwing money at it, which is shameful), and I am left with nine perfectly serviceable sensors in the drawer, waiting for the day that I (or preferably someone else, because there are only so many hours in a day) can figure out how to listen to them without shouting.
I mostly agree what you write.
But if you you use the code I posted earlier and substitute manufacturer id with yours and correct bits to yours in lamda, it should work. I have 3 from different manufacturers working same way.