Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown state even after 0.7.4 update #474

Open
Tvojm100 opened this issue Feb 12, 2025 · 13 comments
Open

Unknown state even after 0.7.4 update #474

Tvojm100 opened this issue Feb 12, 2025 · 13 comments

Comments

@Tvojm100
Copy link

Hi

I thought that changing the 'transmitting power' and 'advertise mode' in HA companion app - BLE settings helped with my unknown state issue. But after monitoring for a couple of days, I still seem to get it.

I am attaching a screenshot and diagnostics as suggested in another post.

Any advice/help would be appreciated.

config_entry-bermuda-01JKVA62KMGXAW98XPVCB95TCZ.json

Image

@oguzcav
Copy link

oguzcav commented Feb 13, 2025

Hello, same in here.

@FvanEgmond
Copy link

FvanEgmond commented Feb 13, 2025

Unfortunately I do have the same experience, also with 0.7.4.
In most cases, the beacon (Android phone with Home Assistant app and BLE transmitter on) is picked up after a couple of minutes by the nearest node, but within 30 seconds it's area is set as Unknown again.
When I put my phone on, it reconnects, but most of the time the area reported remains unknown, as it seems not to keep the beacon after the initial advertisement. (Please note that with ESPresense -running in parallel on my HA- the signal is still seen - but I do like the potential of Bermuda better, as it can reuse all existing bluetooth nodes :-)
It doesn't matter if this is an ESPhome Bluetooth repeater or Shelly device. Most of the time the beacon is within 1-2 meters of the node.
The (disconnect) pattern is consequent, so my wild guess is that it is thrown off by other nodes not reporting that the beacon is in range, and therefore the Area is 'reset'?

@agittins
Copy link
Owner

Hi @Tvojm100, thanks for your report and for including the diagnostics - it makes things a lot easier.

The main issue is that you have max_area_radius set to 5 metres. I'd suggest setting it to 100m or so, so that it doesn't mess with your available data. For about a minute prior to when you did the diagnostics, your phone was detected at 6, 12, 7 and 15m away by the kitchen proxy, but it appeared "Unknown" because the config has the max radius set to ignore anything over 5m.

The signal that the kitchen is getting from your phone is also fairly weak, in the -90dbm range. This probably indicates that your phone is sending a fairly weak signal (it could also/instead be that your proxy's antenna is not very sensitive, or might be in a position where the signal is blocked or the antenna is facing a sub-optimal direction).

If you're using the HA companion app to send the iBeacon advertisements you might want to try setting the transmit power to Medium (Low is the default) as this seems to give much better results on many phones. I usually recommend 3Hz for the advertising rate. After you set the power to medium you will get shorter distance readings in Bermuda, so you might want to change the ref_power in Bermuda back up a bit to compensate for that.

Your proxy configuration looks quite healthy, so no problems there, I think - just the max radius and the transmit power on your phone should hopefully improve things a lot there.

@agittins
Copy link
Owner

@FvanEgmond:

In most cases, the beacon (Android phone with Home Assistant app and BLE transmitter on) is picked up after a couple of minutes by the nearest node, but within 30 seconds it's area is set as Unknown again.

That could be a similar issue, in which case setting the HA companion app transmit power to Medium might resolve or improve the issue.

When I put my phone on, it reconnects, but most of the time the area reported remains unknown, as it seems not to keep the beacon after the initial advertisement.

Are you saying that it reports a distance but not an Area? I might be having trouble understanding what you are explaining here.

If you don't find the transmit power to be the issue, could you upload the result of a "download diagnostics"?

@agittins
Copy link
Owner

@oguzcav can you try the same and let me know how you go? Similarly, if it doesn't fix it, please upload a diagnostics.

@Tvojm100
Copy link
Author

Hi @Tvojm100, thanks for your report and for including the diagnostics - it makes things a lot easier.

The main issue is that you have max_area_radius set to 5 metres. I'd suggest setting it to 100m or so, so that it doesn't mess with your available data. For about a minute prior to when you did the diagnostics, your phone was detected at 6, 12, 7 and 15m away by the kitchen proxy, but it appeared "Unknown" because the config has the max radius set to ignore anything over 5m.

The signal that the kitchen is getting from your phone is also fairly weak, in the -90dbm range. This probably indicates that your phone is sending a fairly weak signal (it could also/instead be that your proxy's antenna is not very sensitive, or might be in a position where the signal is blocked or the antenna is facing a sub-optimal direction).

If you're using the HA companion app to send the iBeacon advertisements you might want to try setting the transmit power to Medium (Low is the default) as this seems to give much better results on many phones. I usually recommend 3Hz for the advertising rate. After you set the power to medium you will get shorter distance readings in Bermuda, so you might want to change the ref_power in Bermuda back up a bit to compensate for that.

Your proxy configuration looks quite healthy, so no problems there, I think - just the max radius and the transmit power on your phone should hopefully improve things a lot there.

Thanks for the reply.

I did have the area distance set to 20m. But changed it to different values for testing. The same was happening at greater set distances too.

For me, the whole setup can work very well for half hour to a couple of hours. But then all of a sudden it getting stuck on unknown without changing anything (including the physical environment).

Those kitchen readings were with me pretty much standing still in the same place. I get this on other scanners too, where being in the same place for 5 minutes, the distance/area state would go from a valid area to unknown. Also the distance would randomly fluctuate by 2-7 metres.

I did increase the BLE values in HA companion app and increased them by 'one step'. I'll try and increase it further.

Thanks.

@agittins
Copy link
Owner

I did have the area distance set to 20m. But changed it to different values for testing. The same was happening at greater set distances too.

Those kitchen readings were with me pretty much standing still in the same place. I get this on other scanners too, where being in the same place for 5 minutes, the distance/area state would go from a valid area to unknown.

Those kitchen readings were taken with the max radius at 5m. If it's still happening at 20m please send another diagnostics, but I'd probably suggest setting it to 100m first.

Also the distance would randomly fluctuate by 2-7 metres.

This is pretty normal for rssi based distance readings.

@Tvojm100
Copy link
Author

Tvojm100 commented Feb 13, 2025

@agittins

Thanks I'll give that a go.

A couple of quick questions if I may:

  • are the global settings per each BT beacon device?
  • On the calibration settings, what to do the numbers 0-4 represent? I get that at each rssi is the estimate distance. But if I set a value of -70, should this not show as one of pair values in the table? I find changing the attenuation to calibrate for the '5m' distance, doesn't seem to move the distance figure significantly (or at all) ?

Image

@agittins
Copy link
Owner

are the global settings per each BT beacon device?

The global settings apply to the entire system, so to all devices. The reason you select a device and a scanner is that those are like your ruler, you use those two to work out what setting works, and apply that to all devices.

On the calibration settings, what to do the numbers 0-4 represent?

It's just indicating the sequence of data received, newest to oldest, it's just counting out the results.

I get that at each rssi is the estimate distance. But if I set a value of -70, should this not show as one of pair values in the table?

The distance is estimated, but the rssi is "measured". Those rssi values are what the proxy recorded the signal strength as, so nothing you do will change that (they will change as new readings come in, and will change as you move the device and signals randomly come and go, but each reading is the "actual" reading at the time it was taken). When you enter a new reference power and attenuation, those are used in a formula, along with the reported rssi, to come up with a distance.

If the device is actually, physically 1 metre away, then entering an rssi value from the list into the reference power setting will cause those readings at that rssi to come out as 1m. For example, if you put in -89 and pressed submit, readings 1 and 4 would then be 1m, reading 2 would be almost 1m etc, and would be a reasonable decision in this case.

Does that make sense?

@oguzcav
Copy link

oguzcav commented Feb 14, 2025

Hello, Sorry for my late reply. Somehow it is solved at this time. But i set global max_area_radius to 5 metres regardless, even though it is working. I'm happy at this time.

Thank you for being there for us.
BR

@agittins
Copy link
Owner

No worries @oguzcav, very glad you have it working, and you're welcome!

@FvanEgmond
Copy link

FvanEgmond commented Feb 14, 2025

That could be a similar issue, in which case setting the HA companion app transmit power to Medium might resolve or improve the issue.

I tried (setting to low instead of ultralow), and although when the beacon is picked up and reported near one node, it stays online for longer (30 seconds instead of 1) but the results stay the same: after that short time, the area is reported as unknown again. After multiple minutes it reports back in (my phone didn't move and wasn't used) and then disconnect within a minute.

Are you saying that it reports a distance but not an Area?

No; When it is connected, it both reports area and distance. So no problem there. When it's not picking up my phone, it both reports as 'Unknown'.

If you don't find the transmit power to be the issue, could you upload the result of a "download diagnostics"?

config_entry-bermuda-01JHTRQH9WTVKP0QB5M0SJSAXW.json

The only beacon I use to test is: iBeacon:c560edaebe434d509cfa887db1c873e7_100_1

@agittins
Copy link
Owner

Thanks for the diagnostics, @FvanEgmond.

It does look like a signal-strength issue. The only scanner that is seeing your phone at all is the study proxy, and the rssi readings are all very weak (about -100dbm is usually about the limit for what they can pick up). Here's the most recent history of readings:

"hist_rssi": [
              -97,
              -98,
              -97,
              -102,
              -98,
              -100,
              -99,
              -97,
              -94,
              -96
            ],

The hist_interval shows how many seconds have elapsed between each detected advertisement (at a max resolution of 1 second, which is how often Bermuda checks the backend). For an esphome proxy we should expect mostly 1s and the odd 2s interval for a device that is nearby:

 "hist_interval": [
              18.999663764843717,
              0.9999823020771146,
              1.9999646060168743,
              61.00292024598457,
              58.99895543209277,
              4.003929098835215,
              54.99102608906105,
              6.003893650136888,
              5.999893717933446,
              33.999397662933916
            ]

We can tell that your studio proxy is working OK though, because it's receiving advertisements for a microsoft device quite consistently (mac address 1c:fc....:63) although it hasn't been present there for a while (or its address has changed):

 "hist_rssi": [
              -70,
              -73,
              -67,
              -66,
              -78,
              -71,
              -66,
              -76,
              -69,
              -67
            ],
"hist_interval": [
              0.9999821039382368,
              0.9999821030069143,
              0.9999821030069143,
              0.9999821039382368,
              0.9999821041710675,
              0.9999821039382368,
              0.9999821039382368,
              0.9999821039382368,
              0.9999821041710675,
              0.9999821039382368
            ],

I tried (setting to low instead of ultralow)

Yes, Low does not seem to give good results, so I suggest using Medium, and if that doesn't work, High. I wonder if the companion app recently changed their default xmit power? It's come up quite a lot lately.

If you enable a few other devices it might give you some good data to compare against, such as some of the Sonos devices - that will let you more easily determine if the issue is the overall system or a single device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants