Expanded Bluetooth Functions

Put this in the forum and never got any response.
Thought I would post it here.

I use the Bluetooth Device Tracker as my way in HA to track when I come home and leave and
it works perfect.
Since bluetooth knows more info then just when it connects, I was wondering if there would be any way
to have entities based on bluetooth phone that is connected.
Say entity.phone_ringing or entity.battery_level.
This would allow alot more control in HA for example to pause media player if phone is ringing etcā€¦

Why not use the official Home Assistant Companion app on your phone, it gives you sensors for next alarm, charging status, battery level, etc.?

1 Like

Where I live my cellular data is faster than my home internet so I donā€™t connect my phone to wifi.
Just thought if bluetooth could show those sensors their must be other people who could use it.

So use the mobile network and the companion app.
Donā€™t understand the problem

1 Like

You can connect your phone ā€œremotelyā€ to HA through Nabu Casa or other methods. No need for WiFi.

1 Like

Donā€™t have Nabu Casa.
Can you point me to info on how to connect phone?

Look at how to set up duckdns

To get into the issue itself a bit more, supporting bluetooth on python is in a bad state. The best that can be done at the moment is support os dependent implementations and they are often not able to be used interchangeably.

Until there is a good python library it is probably easier to use the app as others have stated or create a esphome sensor or something that gets the information via bluetooth for you and transfers it to home assistant.
At least thatā€™s my opinion since Iā€™ve tried to get more robust and generic bluetooth support implemented and although I got it working somewhat, it was never in a good enough state to release and I never got it platform independent and reliable.

Ideally youā€™d want to support bluetooth in home assistant similarly to the way zwave or zigbee are supported.

2 Likes

Thanks for the detailed explanation.
The main thing I was trying to do was sense if my phone is ringing and mute media player.
Any idea on how to do that thru bluetooth with a sensor as you suggested?

That actually sounds doable with tasker (https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&hl=en). You can directly call the home assistant api from there (look on this forum) and trigger based on most things on your phone.

I used it to get my alarm clock time in home assistant before google removed the functionality :frowning:

Will take a look.
Thanksā€¦

So I just updated the home assistant app on android and there is now a ā€˜sensorsā€™ configuration in the app, I suggest you take a look there :stuck_out_tongue:

hint, it looks like there is a sensor exactly for your usecase now right in the app, so no need for workarounds!

Even better.
Thanksā€¦againā€¦

The update is definitely amazing.

Features

  • Sensor Screen
  • Add light sensor
  • Add storage sensor
  • Add bluetooth sensor
  • Add telephony sensor
  • Add next alarm sensor
  • Update wifi sensor on state changes
  • Add nfc support

Any way of getting the sensor for bluetooth connections to show the device name rather than a hex ID in the connected_paired_devices attribute? Since I use bluetooth in the car, I could use it to tell HA when Iā€™m driving. I know I could do that by figuring out the ID mappings to names myself, but it would be nice to have it done for me.

The problem is that not all bluetooth devices give a name as the name was added at a later version. The mac address is something you have direct access to on your phone so it should be easy to map it.

Ah, OK, thanks. Was just a convenience thing, so no big deal.