Open ferinelo opened 1 year ago
Im confused here... I am still back on 2023.5.4 with unsupervised install and not sure if this is the method to get it to work for phone tracking? It isn't LE and again unsupervised. Are people in this case still waiting?
url="http://localhost:8123/api/services/homeassistant/restart"
pip list|grep PyBluez
RC=$?
if [ "$RC" -ne "0" ]
then
apk add gcc musl-dev bluez-dev
pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
[ "$?" -ne "0" ] && (exit 1)
curl -X POST -H "Authorization: Bearer $token" -H "content-type: application/json" $url
fi
url="http://localhost:8123/api/services/homeassistant/restart"
pip list|grep PyBluez
RC=$?
if [ "$RC" -ne "0" ]
then
apk add gcc musl-dev bluez-dev
pip install git+https://github.com/pybluez/pybluez.git#egg=pybluez
[ "$?" -ne "0" ] && (exit 1)
curl -X POST -H "Authorization: Bearer $token" -H "content-type: application/json" $url
fi
Returns
Not sure where how or why I'd need to install the wheels which I really no zip about.
You should install 'python3-dev' with 'apt install xxxx'
is that all i would have to do then bluetooth tracking would work with newer versions of home assistant unsupervised?
looks like xz-dev has moved the underlying component from pybluez
to bleak
- it's just waiting on on a workflow approval - i'm currently stuck at 2023.5.4 ....
any news in 2024.2 version? in this release ships running on Python 3.12!
It's also possible to use bluetooth integration with D-Bus API instead. Here's a proof of concept if anyone wants to try. custom_bluetooth_tracker.zip
Caveats:
- Discovery is not implemented, so trackable devices should already be present in known_devices.yaml
- Bluez experimental features should be enabled (--experimental flag)
Thanks! it works!!!
Anyone knows if using an ESP32 as Bluetooth proxy would let me use the bluetooth tracker component?
It's also possible to use bluetooth integration with D-Bus API instead. Here's a proof of concept if anyone wants to try. custom_bluetooth_tracker.zip Caveats:
- Discovery is not implemented, so trackable devices should already be present in known_devices.yaml
- Bluez experimental features should be enabled (--experimental flag)
Thanks! it works!!!
@freedomanonyme : How have you done this? I have downloaded the zip file and exctract the content. Upload the folder "custom_bluetooth_tracker" with contend to /config/custom_components on my Raspberry Pi 4. Reboot the system. In known_devices.yaml there is still the BT entry for my phone. But the phone is not detected on entitys.
Where is the error? Or how to controll that this costum componet works?
Hi! I don't work with a rasberry Pi. I'm on a generic X86-64 with a USB bluetooth dongle bought on Temu. At first I added the bluetooth dongle in the integrations. After that, I added the folder in my custom components as you said. Did you setup the component in your configuration.yaml? :
panel_custom:
- name: custom_bluetooth_tracker
url_path: custom_bluetooth_tracker
device_tracker:
- platform: custom_bluetooth_tracker
interval_seconds: 10
# seen_interval_seconds: 60
consider_home: 60
I track 2 Iphones added manually in the know devices. However, it doesn't work with a Garmin Fenix 6 watch.
It's also possible to use bluetooth integration with D-Bus API instead. Here's a proof of concept if anyone wants to try. custom_bluetooth_tracker.zip Caveats:
- Discovery is not implemented, so trackable devices should already be present in known_devices.yaml
- Bluez experimental features should be enabled (--experimental flag)
Thanks! it works!!!
@freedomanonyme : How have you done this? I have downloaded the zip file and exctract the content. Upload the folder "custom_bluetooth_tracker" with contend to /config/custom_components on my Raspberry Pi 4. Reboot the system. In known_devices.yaml there is still the BT entry for my phone. But the phone is not detected on entitys.
Where is the error? Or how to controll that this costum componet works?
HI,
I too use a generic x86-64 amd/intel old laptop with a usb bluetooth dongle. I originally used a generic bluetooth dongle supporting v5.1 which proved unreliable so I replaced it with one that was compatible with bluetooth v4.0 ( which I believe is recommended for use with HA).
I don't use the custom panel integration so your first YAML snippet is irrelevant. I do have your second YAML snippet in my config.yaml file.
Did your old system work with iPhones? can you see their device_tracker.x entities using Developer tools > states? I use Android phones and they work. I have never been able to track smartwatches probably because some use BLE which this isn't about, and others only advertise themselves if they are not paired to their App. So I doubt you would have success there.
Hi all... I'm on Home Assistant OS... Without activating --experimental, I saw my iPhone "Home" for a few minutes, then I see this error in the logs "hci0 (00:15:83:FB:C1:9F): Error stopping scanner: [org.bluez.Error.Failed] No discovery started"...
Would someone be able to help me to activate the --experimental feature?
Thanks guys
It's already activated on ha core.
I think your problem is you want to track an iPhone.
On Tue, 5 Mar 2024, 23:00 emanuele-bordon, @.***> wrote:
Hi all... I'm on Home Assistant OS... Without activating --experimental, I saw my iPhone "Home" for a few minutes, then I see this error in the logs "hci0 (00:15:83:FB:C1:9F): Error stopping scanner: [org.bluez.Error.Failed] No discovery started"...
Would someone be able to help me to activate the --experimental feature?
Thanks guys
— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/89119#issuecomment-1979780629, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJIPW7BIYS46D65EGFLXGI3YWZE7PAVCNFSM6AAAAAAVO44ESGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZZG44DANRSHE . You are receiving this because you were mentioned.Message ID: @.***>
It's already activated on ha core. I think your problem is you want to track an iPhone. … On Tue, 5 Mar 2024, 23:00 emanuele-bordon, @.> wrote: Hi all... I'm on Home Assistant OS... Without activating --experimental, I saw my iPhone "Home" for a few minutes, then I see this error in the logs "hci0 (00:15:83:FB:C1:9F): Error stopping scanner: [org.bluez.Error.Failed] No discovery started"... Would someone be able to help me to activate the --experimental feature? Thanks guys — Reply to this email directly, view it on GitHub <#89119 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJIPW7BIYS46D65EGFLXGI3YWZE7PAVCNFSM6AAAAAAVO44ESGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZZG44DANRSHE . You are receiving this because you were mentioned.Message ID: @.>
but @freedomanonyme track iPhone....
@emanuele-bordon might be an adapter issue: #78341.
Oh... I had purchased a "TRENDnet TBW-107UB (CSR8510A10)" among the "KNOWN WORKING HIGH-PERFORMANCE ADAPTERS" for maximum compatibility... :)
@Freedomanonyme can you tell me which dongle you use and if you did something special for iPhone?
Oh... I had purchased a "TRENDnet TBW-107UB (CSR8510A10)" among the "KNOWN WORKING HIGH-PERFORMANCE ADAPTERS" for maximum compatibility... :)
@freedomanonyme can you tell me which dongle you use and if you did something special for iPhone?
Hi! Sorry for the late response. It worked for 48 h… not reliable.
Mines the same now, a hardware reboot brings it back for a few days. No errors when it drops out so it might be a hard one.
Hello, there is no news about this problem ? We can't use bluetooth anymore in the future ? I follow this problem for a long time now and i'm surprised to don't find a solution now :(
Hello, there is no news about this problem ? We can't use bluetooth anymore in the future ? I follow this problem for a long time now and i'm surprised to don't find a solution now :(
I agree. So it must be removed from documentation if it isn't working. I'm using the custom BT integration but it's not discovering any new device so it's partially useful.
Hello, there is no news about this problem ? We can't use bluetooth anymore in the future ? I follow this problem for a long time now and i'm surprised to don't find a solution now :(
I agree. So it must be removed from documentation if it isn't working. I'm using the custom BT integration but it's not discovering any new device so it's partially useful.
How to use the custom BT integration ? There is a procedure ? I think that could help me a lot...
Hello, there is no news about this problem ? We can't use bluetooth anymore in the future ? I follow this problem for a long time now and i'm surprised to don't find a solution now :(
I agree. So it must be removed from documentation if it isn't working. I'm using the custom BT integration but it's not discovering any new device so it's partially useful.
How to use the custom BT integration ? There is a procedure ? I think that could help me a lot...
It is described in this very thread: look for custom_bluetooth_tracker.zip.
Hello, I don't understand how to use the custom tracker...
I add the folder "custom_bluetooth_tracker" in my "custom_components" folder
i have this in my configuration.yaml
device_tracker:
- platform: bluetooth_le_tracker
new_device_defaults:
track_new_devices: false
- platform: bluetooth_tracker
- platform: custom_bluetooth_tracker
My devices are already in the "known_devices.yaml" file
I restarted HA but... It don't seem to work ?
I use a Respberry PI 4 so i think that experimental is on ?
With the latest update (2024.5.0) custom_bt integration is not working anymore. It seems that BT is hated... now I don't have a reliable presence detection anymore.
Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/custom_bluetooth_tracker/device_tracker.py", line 203, in update_bluetooth await perform_bluetooth_update() File "/config/custom_components/custom_bluetooth_tracker/device_tracker.py", line 165, in perform_bluetooth_update adapters = await bluetooth._get_manager(hass).async_get_bluetooth_adapters() ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'homeassistant.components.bluetooth' has no attribute '_get_manager'. Did you mean: 'set_manager'?
Here's an updated version: https://github.com/andriilahuta/hass-dbus-bluetooth-tracker/tree/2024.5.0 Note that I renamed the component slightly.
Here's an updated version: https://github.com/andriilahuta/hass-dbus-bluetooth-tracker/tree/2024.5.0 Note that I renamed the component slightly.
You're a hero.
Hello, After 12 hours, the bluetooth presence detection no longer works... I have to restart HA. Do you also have this problem? Thanks :)
@Blabla4137
I have one instance of HA running on Pi4 and another on a generic x64 chromebook. The chromebook lasts about 3 days before the bluetooth presence stops. On the Pi using the built in adapter it lasts a few hours (not 12). Using an external bluetooth dongle it lasts longer but not days. And yes the only way to get the functionality back is a HA restart, not a hardware reboot (although that works as well). So its not a hardware reset that gets it back and reloading the bluetooth integration does nothing to help.
So, I suspect that, if there is a way of restarting this custom component without a HA restart that would be good.
You're right, it's not necessarily 12 hours... It's random but after a few hours it no longer works. I don't know if everyone encounters this problem and what solution is used... Restarting HA every 4 hours seems unplayable to me. It's true that if we could only relaunch the custom component it would already be simpler! I don't know where the problem could come from and if there could be a solution... Unfortunately, the custom component is no longer usable :(
Unfortunately, the custom component is no longer usable :(
Why? I'm using it right now.
Unfortunately, the custom component is no longer usable :(
Why? I'm using it right now.
It stop to works after many hours and i need to restart HA many times by days... You don't have this problem ?
Look the answer of Duke-Box, he have the problem too
I can't restart HA so many times...
The custom component (this one: https://github.com/andriilahuta/hass-dbus-bluetooth-tracker/tree/2024.5.0 ) s working flawless. I'm using a raspberry 4gb
Unfortunately, the custom component is no longer usable :(
Why? I'm using it right now.
It stop to works after many hours and i need to restart HA many times by days... You don't have this problem ?
Look the answer of Duke-Box, he have the problem too
I can't restart HA so many times...
What HA version are you running? I also had the same issues you described, so I tried updating HA to 2024.6.1 core and 12.3 OS and it's been more than a week and still working. I I think I had like 5.4 core before and BT would stop tracking after a day or two. No errors related to BT to be found in logs though.
I'm using the custom component with a RPI 4 (8gb). Core is on 2024.6.2 ( just updated to 2024.6.3) Os is on 12.3 I can't find errors in logs.
So it seems that several people have (or had) this problem... Maybe it will work for me with the last 2024.6.3 core, i will keep you informed 😊
[Edit]: it stops to work after 2h37min
I tried uninstalling and reinstalling the custom component.
The bluetooth worked for 16 hours 25 minutes and stopped again...
I don't know what i can try now...
I tried uninstalling and reinstalling the custom component.
The bluetooth worked for 16 hours 25 minutes and stopped again...
I don't know what i can try now...
Is your configuration.yaml correct?
It must be something like this: (my configuration)
#################### CUSTOM BLUETOOTH TRACKER ################## device_tracker:
I tried uninstalling and reinstalling the custom component.
The bluetooth worked for 16 hours 25 minutes and stopped again...
I don't know what i can try now...
I have had the same issue since HAOS 12.2. There are several folks reporting issues with directly attached Bluetooth adapters since HAOS 12.2 and HAOS 12.3 did not fix the issue either (https://github.com/home-assistant/core/issues/92379#issuecomment-2153045976).
I installed the HAOS 12.4 update yesterday and the Bluetooth adapter seems to be back to being stable so far after 19 hours. I'll report back if it happens again.
This is my config.yaml
device_tracker:
I didn't change it and before it was working like a charm
I'm on OS 12.4 and the problem is always here
@BigThunderSR, i'm waiting for your return 😊
I'm on OS 12.4 and the problem is always here
@BigThunderSR, i'm waiting for your return 😊
Still hasn't crashed yet and this is way longer than anytime before with 12.2 and 12.3. I hope it's not a fluke that will reappear the next time I have to restart HA. 😄
@Blabla4137 Your yaml in your configuration.yaml doesn't look correct to me. But as you didn't format it correctly it is difficult to tell. I think your yaml looks like this:
device_tracker:
- platform: bluetooth_le_tracker
new_device_defaults:
track_new_devices: false
- platform: bluetooth_tracker
- platform: dbus_bluetooth_tracker
And I am surprised it ever worked if it is like that. Mine looks like this:
device_tracker:
- platform: dbus_bluetooth_tracker
interval_seconds: 10
consider_home: 60
seen_interval_seconds: 30
- platform: bluetooth_le_tracker
new_device_defaults:
track_new_devices: false
Note: - platform: bluetooth_tracker can be removed as it is defunct.
On my generic x64 chromebook platform OS 12.4 running core 2024.6.3, my dbus_bluetooth_tracker has been running continuously for over 24hrs since I updated to 12.4 OS and core 2024.6.3
But on my Pi 4 the latest OS and core hasn't made any difference. In fact I have tried 4 bluetooth adapters, the inbuilt one, a BT 5 USB one and 2x USB CSR 4.0 ones that are the recommended type for HA. I have also found the USB adapters are unreliable if the PI power source isn't powerful enough. I could only get the USB adapters to be recognised consistently by using a 3AMP fast charger PSU with a fast charger cable.
With low power I see this in the HA Core Log on restart
Logger: habluetooth.scanner
Source: components/bluetooth/__init__.py:328
First occurred: 13:43:01 (1 occurrences)
Last logged: 13:43:01
hci0 (00:1A:7D:DA:71:13): Successful fall-back to passive scanning mode after active scanning failed (4/4)
And this in the Host log when it fails:
2024-06-20 12:43:01.345 homeassistant bluetoothd[490]: Path /org/bleak/67/547253029472 reserved for Adv Monitor app :1.77
2024-06-20 12:43:12.382 homeassistant bluetoothd[490]: Disconnecting failed: already disconnected
2024-06-20 12:43:12.511 homeassistant bluetoothd[490]: Disconnecting failed: already disconnected
2024-06-20 12:48:59.335 homeassistant bluetoothd[490]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to A8:79:8D:0F:33:3F: Connection refused (111)
2024-06-20 12:49:07.195 homeassistant bluetoothd[490]: profiles/audio/avdtp.c:avdtp_connect_cb() connect to A8:79:8D:0F:33:3F: Host is down (112)
2024-06-20 12:49:35.297 homeassistant kernel: Bluetooth: Unexpected continuation frame (len 0)
A8:79:8D:0F:33:3F is one of my tracked devices BT ID.
I suspect that if I get the entry in the HA core log then the tracker isn't going to work at all. I don't know if the entries in the Host log are relevant to the issue though.
I'm on OS 12.4 and the problem is always here
@BigThunderSR, i'm waiting for your return 😊
Still hasn't crashed yet and this is way longer than anytime before with 12.2 and 12.3. I hope it's not a fluke that will reappear the next time I have to restart HA. 😄
I had to restart HA yesterday for some maintenance and the Bluetooth issue is now back after a few hours.
Same for me, after couple of hours the tracker stops working. My setup: Proxmox on Wyse 5070 HAOS 12.4 Core 2024.6.3
I'm sorry i didn't see that... Here is my correct yaml 😊
device_tracker:
# - platform: bluetooth_le_tracker
# new_device_defaults:
# track_new_devices: false
# - platform: bluetooth_tracker
- platform: dbus_bluetooth_tracker
It work like a charm before so i think it's ok and the problem is elsewhere
FWIW, I've never had such issues on Pi 4 / Ubuntu 22.04 and Pi 5 / Ubuntu 24.04 with internal bluetooth. I'm not running bluetooth_le_tracker
though, maybe that makes a difference?
FWIW, I've never had such issues on Pi 4 / Ubuntu 22.04 and Pi 5 / Ubuntu 24.04 with internal bluetooth. I'm not running
bluetooth_le_tracker
though, maybe that makes a difference?
I do not have bluetooth_le_tracker on my setup and the problem exists :(
Did anyone find a solution to this problem ? 😊
@Blabla4137
I still think your yaml is wrong. Your yaml is:
device_tracker:
# - platform: bluetooth_le_tracker
# new_device_defaults:
# track_new_devices: false
# - platform: bluetooth_tracker
- platform: dbus_bluetooth_tracker
the indentation of the active "- platform: " is incorrect It should be: (2 spaces in from the d of device_tracker)
device_tracker:
- platform: dbus_bluetooth_tracker
And you are missing the variables, the whole thing should look something like this
device_tracker:
- platform: dbus_bluetooth_tracker
interval_seconds: 10
consider_home: 60
seen_interval_seconds: 30
Try it - if everything else is set up correctly then it should work for a while at least.
My Pi doesn't work at all, probably because of its inadequate PSU, however my generic x64 instance works for days without a HA restart.
So the answer to your question is there is no solution but I believe your yaml is incorrect so the tracker won't work anyway!
@Duke-Box, thank you i tried your yaml.
But same problem after only 1 hour...
Others people have the same problem so i think the problem is elsewhere :(
Hi
I have just updated HAOS to 13.1 and I am getting these in the log. HA takes forever to come back up and the custom dus bluetooth tracker does not work anymore.
Logger: habluetooth.scanner
Source: components/bluetooth/__init__.py:328
First occurred: 15:33:10 (1 occurrences)
Last logged: 15:33:10
hci0 (00:1A:7D:DA:71:13): Successful fall-back to passive scanning mode after active scanning failed (4/4)
hassio.binary_sensor The system is waiting for tasks: {<Task pending name='Task-354' coro=<async_setup_scanner.<locals>.update_bluetooth() running at /config/custom_components/dbus_bluetooth_tracker/device_tracker.py:205> wait_for=<Future pending cb=[Task.task_wakeup()]> cb=[set.remove()]>}
Anybody else seeing similar?
I should add i am running on Pi4 4gb with external usb BT adapter.
Update: This problem was hardware related. Used a more powerful PSU
@andriilahuta, can we implement a reload service into your custom integration? After a few random hours, Bluetooth still loses connection, but a restart fixes it.
async def reload_service_handler(service: ServiceCall) -> None:
This would at least let us automate a reload when it fails.. Cheers
I'm not sure that would help, there's not much to reload within the integration itself actually. Maybe try this branch with extended debug logging and post logs either here or in my repo after Bluetooth disconnects.
The problem
I created new venv with python 3.11.2, installed HA Core 2023.3.1 there and run hass --script check_config I have a bluetooth tracker enabled in my configuration.
HA tries to install pybluez==0.22 and fails with error:
With python 3.10.9 I had no issue at all (currently running venv). I managed to install pybluez from source/github, however this did not solve the issue. Seems like device_tracker integration requires pybluez==0.22 and forces HA to install this version, which is not compatible with python 3.11. I failed to migrate to venv python 3.11 because of this issue.
What version of Home Assistant Core has the issue?
2023.3.1
What was the last working version of Home Assistant Core?
2023.3.1
What type of installation are you running?
Home Assistant Core
Integration causing the issue
Bluetooth Tracker
Link to integration documentation on our website
https://www.home-assistant.io/integrations/bluetooth_tracker/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
No response