Bermuda - Bluetooth/BLE Room Presence and tracking [custom integration]

First of all, in the Bermuda options, make sure you have a large max_radius. If your device measures more than the max_radius distance away, it will show as unavailable. Something like 70m might be good, but 2km is also excellent.

The timeout values only affect the device_tracker sensor (the one that switches between “Home” and “Away”). They have no affect on the Distance and Area sensors.

After setting a max_radius if you still get it switching in and out of Unknown, do a “download diagnostics” and share that - either email it to me [email protected] or raise an issue and attach it there. I can take a look at that and see why you might not be getting regular updates.

My guess is though that it’s just the max-radius setting, which might be at 10m or something.

1 Like

Cool, it was still standard settings. 20 m
Changed it to 70m now, will do testing again!

Really love this integration… but still a long way to go :stuck_out_tongue:
Ok so it doesnt jump to unavailable anymore, which is good.
Still theres only 1 bluetooth scanner active… The one from my raspberry pi running HA OS is not. How do i make it active?

1 Like

Keep persisting. You won’t regret it. This integration is going to be huge when everyone in the HA community catches on to it’s massive use case potential… :smiley:

5 Likes

Is there any way to see the battery level from the tag?

Ok, so I want to get started with this, but can’t make much sense of it. Is there a link with a step by step instructions for dummies?

For example this code

esp32_ble_tracker:
    scan_parameters:
      active: True

I can’t find anything that says exactly where it should go. I have 5 devices flashed with ESP proxy using the ready made projects. Do I edit all 5 of the yaml codes and add that code to them?

Guess that would be the first step… What would I do after?

So I kept reading, and seems the code above is change some settings… still not sure if that would go on my HA configuration YAML or if it would go on the YAML of the actual proxies I have set up.

Then other issue I am having is how do I get Identity Resolving Key for an android device to set up Private BLE Device integration. Instructions are given for MacOS but not for android. Is Private BLE only for apple stuff?

Working on it :slight_smile:

The code block you have can go anywhere in the yaml for your esphome device(s). Each device does need to be done separately, yes. But let me know which boards you are using, and I can give you a complete example to use.

Great, this means you should already have functioning bluetooth proxies, they just won’t be performing as well as they could be. This means everything should be working. The changes to the esphome config are just to improve performance - mainly by having them “listening” for bluetooth for a greater proportion of the time.

I’ve collected what I know about how to get the IRK for various devices in the wiki. Private BLE works great for iOS, Android and watches.

Should i use that too?
I didnt for my android phone…
In the HA companion app i just set the sensor to start transmitting…
Thats the only thing i did for my phone…
Bermuda sees it… and i think the mac doesnt change.

2 things though…
Does the companion app has to be active? Say if i shut down my phone, and power it on again. Do i need to start the companion app? Or will the phone keep transmitting?

Second question: i got a garmin venu 2 watch. I’ve read that indeed if its active with my phone, it stops advertising…
Purpose is, that i track my watch and not my phone… since i carry the watch all the time and the phone not.
How to solve this? Any idea?

Third…
The bermuda integration says my raspberry pi device ((running ha) is a bluetooth scanner device, but it seems its inactive.
How can i use that als active scanner?
Or isnt that possible?

Are you referring to the esp settings or using IRK?

Re esp settings if you’re still using the yaml i posted earlier for you with the package line it in then you are already tuned and good to go.

For IRK vs using iBeacon in the HA companion app, I think the absolute best is to set up both, then in Bermuda just track the IRK entry.

This is because the irk entry will be updated whenever any app on your phone sends advertisements, not just the ha app. And having the ha app makes sure that there should always be something advertising.

However the HA app is still pretty good just by itself, especially on Android. It should start advertising even after a reboot, but it is possible that the phone’s OS might shut it down for power saving etc.

So if getting the IRK would be painful for you i wouldn’t worry about it unless you had trouble with the phone not advertising.

On iOS the system shuts down app advertisements more often, so IRK is a big help for iPhones and iPads.

Yeah this is tricky.

For my watch, i just don’t leave it connected to my phone. There aren’t any features i use that need it, do that works for me but won’t for others - especially if you use it for notifications etc.

The first thing to try is see if there’s a beacon app for your watch. Lots of them seem to have one available, but not installed by default. These will typically advertise regardless of whether it’s connected to the phone.

Another (and more difficult) way to approach it is to use some logic to decide which device to track. You could do this in an automation using conditions, and/or you could create a template sensor helper in ha that does it.

You’d do something like “if the watch sensor is active, report the watch sensor values, else report the phone sensor values”. The idea being that if your watch is out of range from your phone’s Bluetooth it will be sending adverts, but if it’s not sending adverts then assume it’s close to your phone, so use the phone’s sensors. Does that make sense?

I’m travelling currently so I’ll let someone else suggest the yaml / jinja for that if the urge strikes them :blush:

Bermuda can/does use data from Bluetooth adaptors. The tricky bit is that usb Bluetooth adaptors (and i think the pi one is connected via usb, but internally)… are terrible. Across the board, it seems that esphome proxies are more reliable and more performant than usb dongles / on-board bt. It seems they often lock up but HA is unable to reset them because they’re usually not wired to allow it.

You’ll probably find that after a full power reset it will work again. For a bit. I’d suggest googling a bit for your particular breed of pi and ha Bluetooth - if there’s a workaround that should find it.

The other thing about usb / on-board Bluetooth is that they don’t send timestamps for Bermuda to work out how fresh the adverts are. This means they’ll always be “less useful” for Bermuda, and in future there might be features in which we just don’t use their data at all.

Ok, I seem to have it working somewhat. I am not complaining, but seems the info is all over the place, and understandable since you just did the “bermuda” that uses the “private ble” that you didn’t do.

But pretty sure on your github it doesn’t talk about

esp32_ble_tracker:
  scan_parameters:
    window: 900ms
    interval: 1000ms

But as I start reading forums it starts popping up. I am pretty sure at one point I saw a post from you that had the code above with different numbers and you mentioned something like “this is what worked for me”…

I am guessing window is how long it looks for a signal, and interval how long it waits for the next scan correct?

Also just to confirm, i beacon is not needed right? But does it know it is the same? I guess I am not making much sense,

On this picture it says I have 1 device for Bermuda

Now when I click on 1 device I get this screen

On the Diagnostic it has two things. The one that reads Bermuda is coming from i beacon I believe, and the 7ac… that one is coming from Private BLE.

Normal to have both? Any advantages or disadvantages of me getting ride of the one that says Bermuda Tracker? (For the Private BLE I was able to get the IRK key)

Finally, it is showing as “away” even though I am here, but will trouble shoot that on my own as I haven’t played with any of the settings yet. But before I do my troubleshooting I wan’t the “device” set up to be correct (ie one thing listed on diagnostics or both)

Edit as I am doing more testing. I do have LD2410’s connected via bluetooth to some of these proxies, does this create an issue?. I am running tests, and plan to play more with the settings, but just want ot make sure the LD2410s are not part of the problem

LOL so part of my issue is that I had two of my proxies mixed up. So they weren’t getting good Wifi access. But seems connected LD2410s dont create an issue

Great!

Yeah, that’s why I’ve been trying to collate as much info as possible on the Bermuda wiki. This is where you’ll find my current recommendations. The big issue now is that i tend to be so verbose that i think the docs can seem impenetrable :sweat_smile: it’s a continual effort to fine-tune/simplify, while still giving enough info.

1000/980 or so used to be my preferred timing, but i think that 320/290 or in that ballpark might work slightly better, or at least should be less likely to cause “time starvation” for other components.

So that page is all “one device”, but the entities come from two integrations. Yes, the one named Bermuda (and Area, Distance) are all from Bermuda.

The 7ac… one and the “Estimated distance” are from Private BLE Device.

That name, 7ac… looks to be the iBeacon uuid. Did you add the iBeacon tracker in Bermuda config’s “add devices”, or did it just show up like that? I’d recommend that if you have IRK set up, don’t add the device manually to Bermuda, just let Bermuda pick it up from Private BLE’s config.

It’s safe to go into Bermuda’s config and remove it now, and you should still see you have one device, and there’s a good chance it won’t show as “away/unknown” on the private ble sensors.

I haven’t played with these myself yet, but i don’t expect it should cause any trouble. If the ld2410 component does a lot of comms then you might need to open up the ble scanning timings a bit, if you get lockups or errors etc. Also the mmwave stuff might reduce the sensitivity of the Bluetooth radio (because of extra rf noise) but i haven’t read of anyone finding that specifically. People would have similar trouble with the wifi if that were the case, i think.

Haha yeah, there’s so many moving parts it can get pretty confusing at times, it’s easy to miss things!

Glad you’re getting some good initial results though. Oh, and don’t be seduced by the max_radius setting. Lowering it might seem like a good idea but it almost never is - i plan to bump it up a lot by default in future, like 200m or something.

1 Like

Bermuda is awesome! Thanks to Ashley we have the most amazing potential with this exciting project. I have it set up accurately doing it’s thing and trigger automations and TS and iphone app location GUI settings in 4 rooms now. Its actually better than one of these dedicated “presence” sensors. Why? Well think about it. Not only is presence specific to a person, but if you have a wearable on in a room (and automations don’t trigger until you leave or enter another room) that individual is “always” present in that room. Look Mom - no other hiwave/IR/ “presence” detector required! I just need updates to the integration and direction how to set up upstairs and downstairs before I roll out anymore rooms. I am keen to try one of these new BT smart rings as the wearable. I just need to find out which one gives a constant uuid with weeks between charge… :smiley: Rock on Bermuda!!!

So I am doing a new post, which after I post I will come back here and share the link, and hopefully you can answer some of my questions there.

I usually do try to read the documentation, but seems you have gone above and beyond compared to what others do in github. Seems most put everything on ONE page of Wiki. You actually took the time to create different pages, and that is why I didn’t know where people were getting the info from.

Instinctively I was ignoring all them nice blue links on the right side. I would just start scrolling down the text looking for the info I needed. That is 100% on me, but confident many end up doing the same thing. As suggestion, on to of TL/DR you might put a big heading stating “Check the blue links on the right for the info you are looking for”. For those like me that just read the main Wiki page we end up very confused!

2 Likes

^ LOL. Get into it dude. Read up! Then roll it out… trust me… once it all “clicks” in your head (it took me a while)…you won’t be disappointed :smiley:

I don’t plan to quit. All I read is that once it is up and running is pretty neat. For me BIG rather HUGE part of the problem was the fact that I hadn’t seen all them links on the right side.

I am close to finally getting it set up, just having a bit of an issue with selecting devices. I do have an ESP32 running the FryeFryeFrye so now I am able to easily get the IRK’s… so I think I am about 95% of the way there!

2 Likes

So I created a new post that pretty much goes step by step on how to get bermuda working. I am 95% there like I mentioned before, now just having issues adding a 2nd device.

Here is the link Private BLE Device for use with Bermuda BLE Trilateration (and others I guess)

@agittins I invite you to read over my post, then when you get a chance give me some more pointers there…

Again THANK YOU THANK YOU!

1 Like

Awesome, I’ll definitely give it a good read over, and will probably link to it from the guides section of the wiki.

Great feedback, thanks!

Yeah i was refering to IRK (= Private BLE). Will try to set it up.
For my garmin watch, theres no beacon app , very pity. Guess im stuck there…
Although i’m thinking to auto disconnect bluetooth on smartphone when i’m home, and auto connect once im out. I think that wont bother me.+ if the watch sensor is alive, report it, if not use the phone… (in case i do use BT at some time)

ok about the pi…
Will try to make it work first how i’ve it up now…
Cause i added an extra plug (scanner).

BUT , both my plugs arent picking up the smartphone all the time, its very strange…

I get this now

Bermuda can currently see 0 active of 28 bluetooth devices, reported across 0 active of 3 bluetooth scanner devices. No bluetooth devices are actively being reported from your scanners. You will need to solve this before Bermuda can be of much help.

I’m 1m away from a scanner lol
nothing…

Still using your yaml… I also see one plug (the first one i tried) has an update… can i click this or will it overwrite your yaml?

It completely stopped working here

Updating failed with this:

 It fails with the following output:

    Change Dir: /data/build/woonkamer-plug/.pioenvs/woonkamer-plug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/data/cache/platformio/packages/tool-ninja/ninja cmTC_90a15 && [1/2] Building C object CMakeFiles/cmTC_90a15.dir/testCCompiler.c.obj
    FAILED: CMakeFiles/cmTC_90a15.dir/testCCompiler.c.obj 
    /data/cache/platformio/packages/toolchain-riscv32-esp/bin/riscv32-esp-elf-gcc   -march=rv32imc -o CMakeFiles/cmTC_90a15.dir/testCCompiler.c.obj   -c testCCompiler.c
    riscv32-esp-elf-gcc: error: testCCompiler.c: No such file or directory
    riscv32-esp-elf-gcc: fatal error: no input files
    compilation terminated.
    ninja: build stopped: subcommand failed.
    
    

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  /data/cache/platformio/packages/framework-espidf/tools/cmake/project.cmake:381 (__project)
  CMakeLists.txt:3 (project)

After clicking message away, he doesnt say he needs an update anymore, strange

@agittins I’ve read the wiki

I have decided to keep all my proxies “seen” by keeping them as “devices” (Config>select devices)

I don’t know… call me weird I don;t care… I just like to “see” what’s going on with Bluetooth

Case in point.

I have a proxy in a room (I set the named area Bedroom)
It was in there with another two proxies
It was always listing it’s “Bermuda” location as (eye symbol) area = Bedroom ↔ Distance = 2.1m

Then I swapped in/out couple of Shelly devices in that room (for my own “Shelly” reasons)
I didn’t change anything on that other proxies yaml
Well blow me down, now that proxy “thinks” it is in the Family Room like 15 meters away, when I
darn well know it;s in the Bedroom (and I aint changed its location!)
Its Bermuda location now swaps between Unknown and Family Room 15m away!

I know you say you don’t have to actually “add proxies that you are giving fixed locations to” in the integration (for it all to work)

But from a practical understanding point of view it sure helps watching what’s going on!

Few more questions

1/ Why would this proxy change it’s location like it did?
From being in a location 2m near another two proxies - to 15m away…
Seems rather weird…
(Both the Shelly’s were configured exactly the same in the Shelly BT config page of the app)

2/ Is there a specific way to “reboot” the entire Bermuda integration? …so previous history of a device starts from scratch and each device sets it’s “Bermuda location” based on whats’ nearby afresh? … or does building a Bermuda set up become like adding zigbee devices… building a mesh so to speak…“trial and error”?

3/how long before we get trilateralisation so we can “set and nail down” specific proxies to a location?

Thanks!