gigil
(Suddhasheel Ghosh)
May 10, 2022, 1:20am
1
Context: I have set up ESPresence and it works like a charm. However, not happy with the fact that it requires a device of its own. So I was hoping to achieve the same with ESPHome’s inbuilt functionality.
Here’s what I did:
Turning on my home assistant app’s iBeacon and ble tracking on an ESP, I got the following log:
[22:22:59][VV][esp32_ble_tracker:500]: Parse Result:
[22:22:59][VV][esp32_ble_tracker:517]: Address: 67:D7:23:7E:1D:72 (RANDOM)
[22:22:59][VV][esp32_ble_tracker:519]: RSSI: -83
[22:22:59][VV][esp32_ble_tracker:520]: Name: ''
[22:22:59][VV][esp32_ble_tracker:534]: Manufacturer data: 02.15.BC.69.3F.AD.D9.32.40.AA.89.92.E1.F6.FD.44.4E.57.00.64.00.01.C5 (23)
[22:22:59][VV][esp32_ble_tracker:537]: iBeacon data:
[22:22:59][VV][esp32_ble_tracker:538]: UUID: 574E44FD-F6E1-9289-AA40-32D9AD3F69BC
[22:22:59][VV][esp32_ble_tracker:539]: Major: 100
[22:22:59][VV][esp32_ble_tracker:540]: Minor: 1
[22:22:59][VV][esp32_ble_tracker:541]: TXPower: -59
[22:22:59][VV][esp32_ble_tracker:550]: Adv data: 1A.FF.4C.00.02.15.BC.69.3F.AD.D9.32.40.AA.89.92.E1.F6.FD.44.4E.57.00.64.00.01.C5 (27)
I noticed that the UUID was in reverse order of what my phone showed me.
I tried both orders to see if I could track rssi from my phone’s transmission.
- platform: ble_rssi
service_uuid: 'bc693fad-d932-40aa-8992-e1f6fd444e57'
name: "BLE Test Service 16 bit RSSI value"
- platform: ble_rssi
service_uuid: '574E44FD-F6E1-9289-AA40-32D9AD3F69BC'
name: "RSSI value"
No luck, I get an “unknown” value on the GUI, even though RSSI is being read by my esp32 and shows up in the logs
after doing a little digging, I did find the following potential solutions:
esphome:dev
← ignisf:ibeacon-presence-support
opened 08:46PM - 20 Mar 21 UTC
# What does this implement/fix?
This PR adds a convenient way to track the p… resence of iBeacon devices.
## Types of changes
- [ ] Bugfix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Configuration change (this will require users to update their yaml configuration files to keep working)
**Related issue or feature (if applicable):** fixes https://github.com/esphome/issues/issues/1912, fixes https://github.com/esphome/issues/issues/1913, fixes https://github.com/esphome/esphome/pull/937, closes esphome/feature-requests#806
**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs/pull/1069
# Test Environment
- [x] ESP32
- [ ] ~~ESP8266~~ (N/A)
- [ ] Windows
- [ ] Mac OS
- [x] Linux
## Example entry for `config.yaml`:
<!--
Supplying a configuration snippet, makes it easier for a maintainer to test
your PR. Furthermore, for new integrations, it gives an impression of how
the configuration would look like.
Note: Remove this section if this PR does not have an example entry.
-->
```yaml
# Example config.yaml
esp32_ble_tracker:
binary_sensor:
- platform: ble_presence
ibeacon_uuid: 77a6438d-ea95-4522-b46c-cb2b4412076f
ibeacon_major: 100
ibeacon_minor: 1
name: "Jane's Phone"
```
# Explain your changes
* The Home Assistant Android application offers the following useful functionality: [Screenshot](https://user-images.githubusercontent.com/1153188/111885321-c027c700-89cf-11eb-8fec-3833bd48709f.png)
* When activated, it starts emitting iBeacon announcements from a randomly changing MAC address and with no service UUIDs.
* ESPHome currently offers no convenient way of detecting the presence of iBeacons (see the related issues). This makes it hard for users to utilize the Home Assistant application for BLE tracking of their devices.
This PR introduces support for iBeacon presence detection in the `ble_presence` component.
After the ground work here is done, it should be relatively simple to mirror the changes to `ble_rssi` as well.
## Checklist:
- [x] The code change is tested and works locally.
- [x] Tests have been added to verify that the new code works (under `tests/` folder).
If user exposed functionality or configuration variables are added/changed:
- [x] Documentation added/updated in [esphome-docs](https://github.com/esphome/esphome-docs).
and
However, I have no clue how to get code from github into my HA instance(running on an rpi).
I was hoping someone would help me out in that regard. I am partial to the first solution because it seems to have been reviewed by an ESPHome founder and Employee.
Any help would be very welcome