agittins / bermuda

Bermuda Bluetooth/BLE Triangulation / Trilateration for HomeAssistant
MIT License
637 stars 17 forks source link

Max area radius setting ignored in 0.7 #366

Closed ronaldheft closed 1 week ago

ronaldheft commented 2 weeks ago

Configuration

Configured area detection radius: 5 meters

SCR-20241108-kngt

Describe the bug

The setting is ignored. Currently seeing an area detected when meters are 100+.

SCR-20241108-knew SCR-20241108-knjf

Diagnostics

config_entry-bermuda-9e6b6e71fed70d3b1c5d89b3d1e3452e.json

agittins commented 2 weeks ago

Hi Ron, thanks for your report!

I notice that one of your screenshots is of the calibration dialog in the config flow. Do you know if you have restarted or reloaded the integration since that calibration check?

The calibration screen doesn't honour the max_radius since it's a diagnostic tool, but I am wondering if maybe it has had a side-effect on the area matching, since it causes Bermuda to recalculate distances immediately when you SUBMIT that form.

The other possibility is that we have a regression after re-working some of the start-up code to improve performance and stability with recent HA async changes.

I'll see if I can replicate it here when I get a chance, but if you know if it's had a restart or reload (or could try one to check) that might give me some extra pointers in tracking down the issue.

ronaldheft commented 2 weeks ago

Good thought about the calibration. I opened that dialog purely to better see what was happening with distances, so I wasn't adjusting the calibration when I noticed the bug.

To verify, I did just reload the integration and I'm seeing the same issue. I'm currently outside my house in my backyard, far from a BLE tracker, and it's still reporting my area by nearest BLE tracker that should be outside the radius.

image

agittins commented 2 weeks ago

Great, thanks for confirming that for me. I'll dig into it soon and let you know how I go.

agittins commented 1 week ago

Hey Ron, I think this might be a duplicate/complication of #371, where "metadevices" (those tracked by IRK or iBeacon) are failing to mark the Area as "unknown" under any circumstances. It seems to be a regression introduced somewhere between v0.6.9rc2 and the current releases.

My testing so far is showing that devices tracked directly by MAC address work as expected, but for metadevices the device_tracker works but the Area (and as a result the distance) sensors are not switching to unknown when they are out of range.

I'll leave this open separately for now until I have confirmed that the root cause of both issues are the same / both are fixed, but you might want to sub to #371 as well if it's relevant.

ronaldheft commented 1 week ago

Thanks @agittins! I am following #371 now, and I agree, this is related to metadevices. All the devices I have observed this on are IRK, private BLE devices.

I'm okay closing this in favor of tracking all activity on #371, if that's easier.

agittins commented 1 week ago

Great, cheers!

I've just pushed a fix for #371 and it also appears to resolve this issue, at least with the testing I did on my system. I'll be packaging a release later today to include it.