fsaris / home-assistant-awox

AwoX mesh light integration for Home Assistant
MIT License
83 stars 23 forks source link

Making it work with esphome via bluetooth proxy #101

Closed dreyks closed 10 months ago

dreyks commented 10 months ago

Hey!

disclaimer: i understand that this might be too tangential to this repo so feel free to close it as not relevant :D

My HA server is too far from my lights and I'm still trying to battle this. I know I can fully switch to esphome via your esphome integration and that'll be my next step if this one fails, but we'll see

so, I have a Lilygo ESP32S3 stick that is plugged into a tion breezer - this is its primary function. I'm trying to reuse it as a bluetooth proxy, specifically to enable the awox connection

but so far nothing seems to work: the Mesh is seen as unresponsive here's some pieces of my logs

INFO (MainThread) [custom_components.awox] setup config flow entry {'mesh_name': 'pYcDT12h', 'mesh_password': '<mesh_password>', 'mesh_key': '10ca89d8', 'devices': [... all the devices...] }
DEBUG (AwoxMeshCommands-pYcDT12h) [custom_components.awox.awox_mesh] [pYcDT12h] get item from queue
INFO (MainThread) [custom_components.awox.awox_mesh] [pYcDT12h] Registered [a4:c1:38:4d:95:dc] 5596
INFO (MainThread) [custom_components.awox.light] Setup light [5596] EGLO RGB+TW
DEBUG (SyncWorker_1) [custom_components.awox.awox_mesh] startup
INFO (MainThread) [custom_components.awox.awox_mesh] [pYcDT12h] Search for AwoX devices to find closest (best RSSI value) device
INFO (MainThread) [custom_components.awox.scanner] Scanning 20 seconds for AwoX bluetooth mesh devices!
DEBUG (MainThread) [homeassistant.components.bluetooth.manager] tion4s b56928 (70:04:1d:b5:69:28) [connectable]: A4:C1:38:4D:95:DC AdvertisementData(local_name='pYcDT12h', manufacturer_data={352: b'\x96\x10\xdc\x95M8\x02\x06\x11\xdc\x15\x08\x01\x7f\x00\x00\x042\x00\x00\x00\x00\x00\x00\x00\x00\x00', 76: b'\x02\x15C/SIn\x8dH\x06\x95z\xd3\xf9sZ\xc7\x1b\x01`\x10\x96\xba'}, service_uuids=['00001800-0000-1000-8000-00805f9b34fb'], tx_power=-127, rssi=-75) match: set()

^ several consecutive messages like this. "tion4s b56928" is the name of the lilygo stick

INFO (SyncWorker_7) [custom_components.awox.bluetoothctl] found: {<... lots of other bt devices ...>, 'A4:C1:38:A8:FC:78': {'mac': 'A4:C1:38:A8:FC:78', 'name': 'pYcDT12h', 'rssi': None}}
DEBUG (MainThread) [custom_components.awox.awox_mesh] [pYcDT12h] Scan result: {'A4:C1:38:A8:FC:78': {'mac': 'A4:C1:38:A8:FC:78', 'name': 'pYcDT12h', 'rssi': None}}
WARNING (AwoxMeshCommands-pYcDT12h) [custom_components.awox.awox_mesh] [pYcDT12h] Command failed, retry 1
WARNING (AwoxMeshCommands-pYcDT12h) [custom_components.awox.awox_mesh] [pYcDT12h] Command failed, retry 2
WARNING (AwoxMeshCommands-pYcDT12h) [custom_components.awox.awox_mesh] [pYcDT12h] Command failed, retry 3
ERROR (MainThread) [custom_components.awox.awox_mesh] Error fetching awox data: No device connected
DEBUG (MainThread) [custom_components.awox.awox_mesh] Finished fetching awox data in 22.118 seconds (success: False)

the question is why there's rssi=-75 match found from the manager, but awox doesn't see it. or am i totally misunderstanding this?

fsaris commented 10 months ago

Hi,

Unfortunately bleak, the framework used to talk Bluetooth by esphome and home assistant core, is currently not able to handle the way AwoX/telink uses BLE.

See also a previous issue https://github.com/fsaris/home-assistant-awox/issues/86#issuecomment-1409278912

dreyks commented 10 months ago

I see, esphome component it is then. thx for the quick response and for all the work you're doing!