Open Colorado4Wheeler opened 2 years ago
Thanks for reporting and the helpful error log. I have an idea on fixing this, but it might take some time. I assumed that the characteristic UUID is the same for all Triones. Apparently not, so the implementation needs to query for the characteristics UUIDs first.
I did more digging into this. I think the implementation correctly follows this protocol.
It is possible that your device is using different UUIDs. Can you connect to your device using a BLE debug app (such as this) and share the service and characteristic UUID it exposes?
Found more characteristic UUIDs from another open source Triones implementation.
Do try the latest code if it fixes the issue. Otherwise, I will need you to do BLE scanning of your device the find the necessary UUIDs.
This error originated from a custom integration.
Logger: custom_components.triones
Source: custom_components/triones/triones.py:101
Integration: Triones (documentation, issues)
First occurred: 15:06:06 (3 occurrences)
Last logged: 15:06:13
Error getting status: [org.bluez.Error.Failed] Software caused connection abort
Have the same problem, too. To give some context, it was this one: https://pt.aliexpress.com/item/33002886875.html
@claudiocn this looks like a different error. Please enable debugging for full error trace.
here it is:
2021-12-08 16:27:49 ERROR (MainThread) [custom_components.triones] Error getting status: [org.bluez.Error.Failed] Software caused connection abort
2021-12-08 16:27:49 DEBUG (MainThread) [custom_components.triones] Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/triones/triones.py", line 69, in update
await self._device.connect(timeout=20)
File "/srv/homeassistant/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 278, in connect
assert_reply(reply)
File "/srv/homeassistant/lib/python3.9/site-packages/bleak/backends/bluezdbus/utils.py", line 23, in assert_reply
raise BleakDBusError(reply.error_name, reply.body)
bleak.exc.BleakDBusError: [org.bluez.Error.Failed] Software caused connection abort
2021-12-08 16:27:49 DEBUG (MainThread) [custom_components.triones] cc 23 33
Seems to be a timeout, don't know why :\
@claudiocn this is common. See this issue. It is a BLE connection issue that will self recover. The debug log “cc 23 e3” shows that it successfully recovered and sent a BLE message.
I will make an update to the logs to make it clearer.
But the problem is: it doesn't connect at all when setupping.
Just to give a try, tested with the following tool and it worked perfectly: https://github.com/vinceroti/bt-triones
Oh, so it never finish setup. The library you tested is using your browser’s (local) Bluetooth hardware, not Home Assistant’s.
For troubleshooting:
Disconnected from the other library. Didn't work. Turned it off and on again. Didn't work. Retried a couple of times and nothing.
2021-12-08 17:05:57 ERROR (MainThread) [custom_components.triones] No supported read/write UUIDs found
2021-12-08 17:05:57 DEBUG (MainThread) [custom_components.triones] cc 23 33
2021-12-08 17:06:06 ERROR (MainThread) [custom_components.triones] No supported read/write UUIDs found
2021-12-08 17:06:06 DEBUG (MainThread) [custom_components.triones] cc 23 33
2021-12-08 17:06:13 ERROR (MainThread) [custom_components.triones] No supported read/write UUIDs found
2021-12-08 17:06:13 DEBUG (MainThread) [custom_components.triones] cc 23 33
2021-12-08 17:07:12 ERROR (MainThread) [custom_components.triones] Error getting status: Device with address FF:FF:CD:02:EE:19 could not be found. Try increasing `timeout` value or moving the device closer.
2021-12-08 17:07:12 DEBUG (MainThread) [custom_components.triones] Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/triones/triones.py", line 69, in update
await self._device.connect(timeout=20)
File "/srv/homeassistant/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 216, in connect
raise BleakError(
bleak.exc.BleakError: Device with address FF:FF:CD:02:EE:19 could not be found. Try increasing `timeout` value or moving the device closer.
2021-12-08 17:07:12 DEBUG (MainThread) [custom_components.triones] cc 23 33
Thanks, this is have better logs and is the same issue here. No supported read/write UUIDs found
means that the read UUID for your device is not known. Unfortunately, Triones uses many different UUIDs.
The test tool you used will only do writes to your device, but not reads (it does not know the current device state). The missing UUID here is for reads.
Can you help do this:
It is possible that your device is using different UUIDs. Can you connect to your device using a BLE debug app (such as this) and share the service and characteristic UUID it exposes?
From what I see, it's doing a match, it's a known UUID :\
Yeah, it’s weird. I’ll add some more debug logs later to figure this out.
Well, using it directly through the gatttool
tool, did the following commands and using the source code in the bt-triones to get the values to be sent, did the following and it's working perfectly from the RPi from where I'm using Home Assistant:
gatttool -I
to startconnect FF:FF:CD:02:EE:19
to connect to the trione with that Mac Addressprimary
to see the actions (handle), the first one did nothing, but the second one (0x007) did! so with the bt-triones values...char-write-cmd 0x007 cc2433
to turn offchar-write-cmd 0x007 cc2333
to turn onchar-write-cmd 0x007 5600ff0000f0aa
to change to colour: R=00, G=ff, B=00
values come from here (from bt-triones source code):
Can you add logs to the triones.py:72 uuid detection code to see why it’s not finding the uuid?
You can modify the code inside config/custom_components/triones
folder, and restart HA afterwards.
It seems to be empty.
2021-12-08 20:00:01 INFO (MainThread) [custom_components.triones] {}
2021-12-08 20:00:01 ERROR (MainThread) [custom_components.triones] No supported read/write UUIDs found
2021-12-08 20:00:01 DEBUG (MainThread) [custom_components.triones] cc 23 33
Try logging self._device.services.characteristics.values()
instead
LOGGER.info(self._device)
LOGGER.info(self._device.services)
LOGGER.info(self._device.services.characteristics.values())
2021-12-08 20:06:01 INFO (MainThread) [custom_components.triones] BleakClientBlueZDBus, FF:FF:CD:02:EE:19
2021-12-08 20:06:01 INFO (MainThread) [custom_components.triones] <bleak.backends.service.BleakGATTServiceCollection object at 0x7f4a0c90d0>
2021-12-08 20:06:01 INFO (MainThread) [custom_components.triones] dict_values([])
Not sure why the library is not detecting any characteristics. You can check if it detects it if we go through each service. Sample code here.
Meanwhile, you can hardcode the uuid in code too as a workaround. Just set self._write_uuid
and self._read_uuid
in the __init__
method in triones.py
.
Did some digging with that sample code. the list of services is empty. Can't do a ".values()" but printing for each loop returns zero iterations. Really strange.
Probably because of that, even if I put the UUID, it doesn't work:
2021-12-08 20:59:23 DEBUG (MainThread) [custom_components.triones] Traceback (most recent call last):
File "/home/homeassistant/.homeassistant/custom_components/triones/triones.py", line 90, in update
await self._device.start_notify(self._read_uuid, create_status_callback(future))
File "/srv/homeassistant/lib/python3.9/site-packages/bleak/backends/bluezdbus/client.py", line 915, in start_notify
raise BleakError(
bleak.exc.BleakError: Characteristic with UUID 0000ffd9-0000-1000-8000-00805f9b34fb could not be found!
2021-12-08 20:59:23 DEBUG (MainThread) [custom_components.triones] cc 23 33
Not sure if this is useful, but here's some additional information:
pi@raspberrypi:~ $ gatttool -i hci0 -b FF:FF:CD:02:EE:19 --characteristics
Discover all characteristics failed: Request attribute has encountered an unlikely error
pi@raspberrypi:~ $ gatttool -i hci0 -b FF:FF:CD:02:EE:19 --primary
attr handle = 0x0001, end grp handle = 0x0004 uuid: 0000ffd0-0000-1000-8000-00805f9b34fb
attr handle = 0x0005, end grp handle = 0x0007 uuid: 0000ffd5-0000-1000-8000-00805f9b34fb
pi@raspberrypi:~ $ gatttool -i hci0 -b FF:FF:CD:02:EE:19 --char-read
A valid handle is required
pi@raspberrypi:~ $ gatttool -i hci0 -b FF:FF:CD:02:EE:19 --interactive
[FF:FF:CD:02:EE:19][LE]> exit
pi@raspberrypi:~ $ gatttool -i hci0 -b FF:FF:CD:02:EE:19 --char-desc
handle = 0x0001, uuid = 00002800-0000-1000-8000-00805f9b34fb
handle = 0x0002, uuid = 00002803-0000-1000-8000-00805f9b34fb
handle = 0x0003, uuid = 0000ffd4-0000-1000-8000-00805f9b34fb
handle = 0x0004, uuid = 00002902-0000-1000-8000-00805f9b34fb
handle = 0x0005, uuid = 00002800-0000-1000-8000-00805f9b34fb
handle = 0x0006, uuid = 00002803-0000-1000-8000-00805f9b34fb
handle = 0x0007, uuid = 0000ffd9-0000-1000-8000-00805f9b34fb
Another guess is we need to call await self._device.get_services()
explicitly before querying the services in some implementation. Example here.
Can you try it?
the same problem, No supported read/write UUIDs found I have changed UUIDs for that which I got in Bluetootk scanner app, the same, any idea? I see that there is no new information since 12.2021,
I create supported code repository for uuid 0000fff3-0000-1000-8000-00805f9b34fb is elk-bledom strip.
I also detailed this on your announcement post on HASS forums.
The light gets detected but then when you select the light it refuses to connect to it and add it to HA.