Open rarroyo6 opened 4 years ago
Just wanted to watch this as I want this option as well :)
watching
This would be amazing. I already have several ESP32s with ESPHome installed and BLE presence detection is the only thing they're missing. If the monitor
project linked above can do it using NAME
requests, would it be easily implemented in ESPHome?
This feature request is opened on Nov 16 of 2019, and we already have a wonderful reference, so let's guess when could it become reality?
I hope this gets added soon. I would love to use my existing ESP32's running ESPHome for lights to add some BLE tracking I know it is still low, but 17 thumbs up must count at least a little. :)
It seems that this would require another separate BLE component in ESPHome. NAME requests should not be spammed to avoid causing too much 2.4 GHz traffic and to prevent the risk of missing a response. The flowcharts shown here should be implemented: https://community.home-assistant.io/t/monitor-reliable-multi-user-distributed-bluetooth-occupancy-presence-detection/68505
This would still be nice to have on esp-home, but I have not seen any new activity on this for over a year. Is there anything on the plans, or should we consider this dead, and look for other solutions?
With the new Sonoff NSPanel which has BLE and can be flashed with ESPHome, it might be time to look into this again. Several NSPanels throughout the house will allow control and presence detection.
should we consider this dead, and look for other solutions?
Even if it isn't dead, given nothing has happened in more than a year I'd be interested in other solutions. Do you have something in mind that might potentially work?
It sounds like maybe nobody has worked on a solution, though this may still be the best solution (note I do not watch this repo so I am not aware of other issues).
The most ideal scenario is that the ESP would listen for new random MAC advertisements, asks if the known devices have arrived when there is such an advertisement, and then updates the state. When the advertisement expires, it should ask again.
See these two flowcharts from the post I linked to above:
However, I think this is maybe difficult to implement with only one 2.4GHz radio. Responding to the random MAC advertisements is hard if the radio can only be in Bluetooth or WiFi mode and not both simultaneously (I say this without knowledge of if the ESP32 can do this). You would miss advertisements while the device is in WiFi mode.
If you have to cycle between the modes, then the best you can do is this method (image also from post above:
However, this totally spams the 2.4 GHz band asking for names and has a (supposedly) noticeable effect for nearby WiFi devices if it is constant. Especially if you have lots of ESP32 around doing presence detection.
But a first step is definitely implementing the the time-interval-based scanning method.
I could definitely see the former solution (only asking for presence when devices arrive) working with the following scenarios, though neither are particularly accessible to all users/devices:
For the time interval-based system, there are some options to make it less hard on the 2.4GHz band:
Right now, the BLE tracker does not support devices which issue a random MAC address, such as a phone or tablet.
Finally we get it https://github.com/esphome/feature-requests/issues/2285
Describe the problem you have/What new integration you would like Right now, the BLE tracker does not support devices which issue a random MAC address, such as a phone or tablet.
Please describe your use case for this integration and alternatives you've tried: The built-in "bluetooth_tracker" in HA works properly, as long as the MAC address of the device is known. It would be nice for the ESP32 tracker to be able to detect the devices if the MAC address is known, even if it broadcast a random address. This way, multiple presence trackers can be placed throughout the hose, to avoid dead-spots.
Additional context There is another project which does something similar here: https://community.home-assistant.io/t/monitor-reliable-multi-user-distributed-bluetooth-occupancy-presence-detection/68505