I can confirm this is still working solidly for my Mi Band 4.
Esphome config below. It’s pretty standard. I’m not using the commented out rssi part at the moment.
You need to follow the other standard steps for ESPHome integrations etc.
It’s possible that you may need to enable Discovery mode in the Mi Fit app for you band to advertise properly (Something like Mi Band app > Mi band 4 device > set ‘Discoverable’ to ‘On’)
If you can describe a little more at which point you think you are getting stuck I may be able to help more.
Hello Mahko,
I’ve just finished configuring my first esp32 ble tracker based on your settings…and it works very well…
What I’m trying to achieve now is the setting of a room occupancy detection system, based on a handful of esp32 tracker spreads around my house.
I can think to a sensor that would track my MiBand around the house, showing the room I’m at the given moment.
Did you do something like this?
If so, have you got some tips?
No I don’t use it for room level detection, just “home level”. I think you’ll have to sift through some of the threads on the topic.
I think the state-of-the-art for room level detection is still Monitor (running on pi zero) , there has been some dicussion about porting that to ESP32.
I think you may have challenges with detection times being too long (for lights, you proabably want this under second?). If you have motion detectors you might be able to use them for the intial detection/action, then use the esp32 presence to hold the scene.
Your best bet is to search other threads for "room presence detection on ESP32 or EPHome and see where it’s all at.
If you were to try to use ESPhome, you would need to use the rssi sensor - you can approximate which node is closest.
May I ask where to add this code? In configuration.yaml file? I got a mi band 4 and wondering how to make it work with HA. Can you plz tell me in simple steps.
Thanks
I have connected esp32 using HA esphome addon. I have followed the tutorial, added an entry in esp32.yaml file, and restarted my pi, however, I do not find my miBand4 anywhere in entities.
I have added the following code in esp32.yaml file,
The picture in you post above “my esp32 is on and running, have a look at the picture attached.” has a little text link saying “show logs”. When that fires up and if the ble scanner is working properly, you will see log lines detecting devices around you. If it’s seeing your mi band every now and then, then we can move on to next steps…
As it is all now setup and working as solid as a rock, I would like to get something more out of it. Is it possible to switch a relay ON/OFF attached to pin2 of the same esp32 based on presence detection?
Both devices need to have traditional bluetooth for bluetooth tracking. Mi band only has BLE.
You may be able to track your Mi Band with your raspberry pi (both have BLE) using the Bluetooth LE Tracker. You would need to research/investigate. Also research potential Wifi performance issues as that’s a thing.
hello unfortunately miband4 does not work if it is paired with the mifit application, you can scan miband if the application disconnects from it or turns off the phone then miband sends a ble signal unfortunately in the miband application there is no make discoverable option, maybe in older versions there was such an option or someone can solved this problem?