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
Breaking Change: Add friendly BT name next to the mac address if we have it #2697
Breaking Change: Add friendly BT name next to the mac address if we have it #2697
Conversation
app/src/main/java/io/homeassistant/companion/android/sensors/BluetoothSensorManager.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works correctly, and users can make it a non-breaking change by splitting the sensor attribute strings on spaces (" ") and using the first value
Can you elaborate on that? I'll give you an example of what was working for me earlier: I had a sensor that calculated distance traveled by my cars, based on me and my wifes phone connecting to its BT beginning like this:
Now, for my phone the friendly name is available, but it's not for my wife, so I can't just change the "bt_mac" variable to include friendly name. Connected paired devices attribute returns a list, so I can't just use .split(" ") on it (at least it's not working for me in template dev tools). And when in my car I always have more then 1 device connected, as I use a smartwatch. So what I'm really looking for is to find if there is a device with mac, for example '12:34:56:78:9A:BC' in a list looking like ['12:34:56:78:9A:BC (CAR RADIO)', 'DE:F1:23:45:67:89 (SMARTWACH (MODEL))'] The only way I currently came up with is (and that's for just 1 phone)
Which is waaay more complicated than what was working before:
Do you have a simplier way of checking, did I miss something? And I also have some automations based on phone connecting with car, so I have to rewrite those too... |
Okay, I managed to find a simplier fix with the help of my FB group. It just requires converting the list to a string. I leave it here for someone who might encounter simillar problem
|
Summary
Fixes: #2696
This is a breaking change because the friendly name will now be added to the Mac address if we have it, otherwise it will print the address again.
New format will be:
MAC (Name)
Also cleaned up some warnings and removed a commented line
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes