hass-divoom icon indicating copy to clipboard operation
hass-divoom copied to clipboard

Add support for Home Assistant Bluetooth config

Open ntindle opened this issue 1 year ago • 6 comments

ntindle avatar Aug 16 '22 03:08 ntindle

Hey, thank you for your interest. I've also seen that and it's already on my todo list, but I don't know when I will have time to refactor that part.

d03n3rfr1tz3 avatar Aug 16 '22 05:08 d03n3rfr1tz3

I don't mean to push this at all if you don't have the time, so I'm sorry in advance. I wish I had the skill to help out myself, but I'd love to donate if that'd help a little and you're willing to accept it. Thanks!

ajlunis avatar Aug 23 '22 05:08 ajlunis

I guess that means it would work with ESPhome based Bluetooth Proxies as well. Which is what i really would like to see. 2022.9 added only passive connections, but 2022.10 extended this to active connections as well (which is probably what is needed for this use case ...).

https://www.home-assistant.io/blog/2022/09/07/release-20229/#bluetooth-everywhere https://esphome.io/components/bluetooth_proxy.html

ryoku-cha avatar Oct 07 '22 20:10 ryoku-cha

I understood it to make it configurable through the UI. Currently you have to get the MAC address (for example using hcitool) and then pair it with your Host (for example using rfcomm). I'm not sure if I found the correct information to do that, because most of the documentation only mentions BLE, but Divooms devices are using BT. But I'm planning on trying out a few thing to then hopefully get rid of the manual stuff that makes it especially hard for hass.io users, that don't have root access to the Host system.

Sure I also looked into their changes and additions regarding the connections, but could only find thing about Bleak. But Bleak is for BLE only and therefore not usable here. The active connections thing sounded promising in 2022.10, but at least yesterday I couldnt find useful information on how the python code connecting and starting a socket would look like. Bluetooth connections (through socket) are included in python 3 itself, which my code already uses. Therefore it depends on how 2022.10 extends active connections (for ESPHome proxies) and if that just works out-of-the-box with BT active socket connections via that python 3 provides or if there is something else we have to use.

d03n3rfr1tz3 avatar Oct 07 '22 21:10 d03n3rfr1tz3

Finding this project helped me justify picking up a Pixoo to play around with. I'm running Home Assistant OS (fka Hass.io) in a Proxmox container on a NUC. HAOS keeps the Python environment locked down, and the upgrade to Python 3.10 in HA 2022.7 broke anything that required pybluez like your initial code.

I haven't been able to get either of your branches or enoy19's fork to connect to the Pixoo. HAOS doesn't have hciconfig/hcitool or rfcomm, but using bluetoothctl I was able to pair with the Pixoo. Trying to manually connect makes the Pixoo briefly flash the Bluetooth icon but then throws a br-connection-profile-unavailable error from bluez.

Are you in touch with enoy19 or kevstar78? They seem to be making progress on post-2022.8 autodiscovery using Bluetooth and Wi-Fi respectively. I'm not competent enough with the HA architecture yet to submit pull requests, but I would be happy to help test.

mwhdc avatar Oct 26 '22 17:10 mwhdc

Following up - I can talk to a Pixoo from a HAOS install using your feature/bt-discovery branch and a manual entry in configuration.yaml. Everything works well except the effects mode which doesn't seem to do anything, and the image mode which failed with an "OverflowError: int too big to convert" on some of the 16x16 static GIFs I tried. Let me know when you have time to look at the project and I'll send logs.

mwhdc avatar Oct 27 '22 00:10 mwhdc