How do i fix Unable to install package pybluez==0.22: error:

It’s not a bug - it’s just that pybluez and Python 3.11 don’t play together.

3 Likes

There will be no “new” version, nor a fixed “bug”. It is something that is out of the scope of HA, and therefor will not be solved by HA.

If you use HA-OS or a supervised install, there is no need for any of this. If you use another installation method, you have to take care of it yourself. Yourself in this case means, you will have to do some extensive Linux work or find another alternative to use instead of pybluez.

HA requires Python 3.11 or above. Pybluez isn’t compatible with this Python version, and as long as nobody is willing to revive the pybluez package, there will never be any solution, it is just incompatibility. That’s it, end of story. :slight_smile:

3 Likes

I am running on Raspberry Pi 3 HassOS
Home Assistant 2023.8.0
Supervisor 2023.07.1
Operating System 10.4
Frontend 20230802.0 - latest

Can you clarify what you mean by this?

If you use HA-OS or a supervised install, there is no need for any of this.

1 Like

Folks,
This is not a “bug”. This “feature” was dependent on pybluez, which is not developed or maintained by the HA folks. pybluez does not play well with the latest version of Python and it looks like development and updates have stalled (Look here: https://github.com/pybluez/pybluez )
I used Bluetooth tracking until it was deprecated. There as several better ways to track presence. In my case, I track presence via my Wi-Fi connection (Unifi integration) + Home Assistant Mobile App + ESPHome (BLE device tracking).

1 Like

Hi, what do you mean by that? (GPS positioning?)
I use WiFI and ESP32 Bluetooth LE too, it was handy to have BT too but I can live without and I am thinking now of deleting the BT integration, it is so error-generating…

Correct. Using HA Zones, you can very accurately determine your location for home presence.

Well yes, but GPS is not fast in that response, at least from my previous experience, I don’t know if that code was made more accurate lately, maybe I’ll try again :+1:

1 Like

You can still use BT in that regard. Tell us exactly, what you want, and more important, what devices you have, where you want this to be used.

As an example, this is my setup in a nutshell. This is all in the hallway, where I want the best presence detection. There are more devices that get triggered by my BT devices, but to keep it short:

  • Tablet / Android / HA companion app
  • ESP32 in one adjoining room
  • ESP32 in the guest toilet (as well an adjoining room)
  • Tablet / Android / HA companion app (at the “livingroom end” of the hallway)

All these sent different BT findings to HA. The big difference is: my setup calculates the data for sensors and all else on these devices, and not in HA itself (the server install). This way you get sensors or binary_sensors in HA and can react on these to calculate a more accurate presence. :slight_smile:

Thank you for your contribution, I have ESP32 (only BLE) and a tablet as well, but I like things simple, so only a quick update (my scan time is 120 seconds) for home or not_home of my phone and watch (watch is both BLE and BT, that is useful).
BT is still running with the workaround but I am thinking to move away in some way if I can still have an accurate presence “sensitivity”.

I’m not sure, if I understand you right, but BT (as in the standard for transmission) is the only way to get an accurate presence detection. Accurate in these terms mean something like a room presence with distances and all.

If you just want to track a home/not_home state, tablets and ESP32s are ideal. They both are able to track all BLE signals, that come from a beacon or the beacon functionality from the HA companion app. You won’t get distances and these things (as I said, this is something for ESPresense), but an accurate yes or no for the devices you scan.

Yes, I agree about the accuracy, GPS zoning isn’t accurate as BT.
As I said, I have a tablet too that is fixed on the wall, so I don’t bring it with me, so maybe I don’t understand how to use it as a detector of other elements (phones or smartwatches) to reveal the presence or not and how to communicate it to HA. Do you use it in this way or were thinking about mobile use of the tablet like the phone?
And the last, ESPHome is good only for BLE and I am using it properly, as proxies, so BLE is fully covered. I am referring only to BT which is having problems with the Pybluez library no more compatible with the new version of Python.
BTW, thank you for the informations and good night, here it is late :slight_smile:

BT range is non-directional and random. MMWave is the way forward.

I’m totally with you, but most of us don’t have these at home, yet. :slight_smile:

BT/BLE is already in every house hold, phones and (old) tablets are highly likely in a tech oriented house hold (what a HA household is), why not use them? :slight_smile:

Meh, the wife was always annoyed when her phone was in the living room, she was in the kitchen. The lights went off. With MM - it isn’t an issue and it even works for guests. Human in the room (if needed turn on the lights) - don’t turn off of the lights.

Makes the BT solution look like the stone age (and yes I used the BT solution for 3 years and then…)

Boun Giorno Michele! :slight_smile: È già tardi qui a Monaco di Baviera! :laughing:

The companion app has different BT settings for broadcasting as an iBeacon, and for scanning for BLE signals. So the tablet, stationary as mine are as well, gets the HA companion app and scans for BLE signals. The phone uses the HA companion app to broadcast an iBeacon signal. The watch already broadcasts as an iBeacon. The ESP32 scan explicitly for these signals. :slight_smile:

I assume, you’re using your ESP32 as a bluetooth_proxy and based on that maybe an esp32_ble_tracker. What I’m using is ble_presence on the ESP32.

binary_sensor:
  - platform: ble_presence
    mac_address: <mac_address_phone_beacon>
    name: "presence_michele_phone_beacon_hallway"
    device_class: presence
  - platform: ble_presence
    mac_address: <mac_address_watch>
    name: "presence_michele_watch"
    device_class: presence

If you configure the app, you will get a sensor, where all beacons are listed as a seperate attribute. Now you can filter for these in a template sensor as well, and voilá, you have a nearly real-time presence for your BT devices with very different locations in your home. :slight_smile:

PS: I know, that might be to compact to understand it fully, so feel free to come back with questions. :slight_smile:

Good night over the alps! :slight_smile:

I assumed you were talking about home presence. For room presence I use a combination of ESPHome + m5stack-atoms (Phone BLE tracking) and Tuya Zigbee MmWave sensors

What is the range of BLE? I’ve made some tests yesterday and it seems that I can detect the phone from my raspberry only in maybe 2 meters…

Guten tag Patrick :slight_smile:
I had your configuration some time ago but it was not so handy, now I have presence sensors for the rooms so I don’t need to have a device with me or the other people in the house, the first step was PIR sensors and now I am trying exactly the Tuya Zigbee MmWave :slight_smile:
So I used BT together with BLE and WiFI presence only to quickly and precisely identify when I am home or not.

1 Like

Yes, I was talking just about home presence.

1 Like

Looking in github, there’s a “partial” fix for the issue.
Here (Bluetooth tracker does not work with newer python - Can't run HA Core on python 3.11.2 because of dependency to pybluez==0.22 · Issue #89119 · home-assistant/core · GitHub ) the user andriilahuta (I don’t know if he posts here) posted this fix: https://github.com/home-assistant/core/files/12307006/custom_bluetooth_tracker.zip that seems partially cover some of the issues. It doesn’t search for new devices, so the addresses must be already in known_devices.yaml. More precise information here Bluetooth tracker does not work with newer python - Can't run HA Core on python 3.11.2 because of dependency to pybluez==0.22 · Issue #89119 · home-assistant/core · GitHub .
I’ve not tested the fix atm, I’ll try it soon.