icanos / hassio-plejd

Hass.io add-on for Plejd home automation devices
Apache License 2.0
126 stars 37 forks source link

Unable to find correct BT characteristics #273

Closed arneroen closed 1 year ago

arneroen commented 1 year ago

Hello! After a recent (at least for me..!) round of updates to HA, this add-on has stopped working for me :/ Previously everything was working perfectly.

I can see from the logs that it connects to the plejd-servers just fine, and the connection to mtqq is also fine. It also seems to find the bluetooth device, but then it fails when it's missing some "characteristic" (not overly familiar with BT..).

Here is (what I think is) the relevant log snippet:

2023-06-05 21:33:52 VRB [plejd-ble] Connected. Waiting for timeout before reading characteristics...
2023-06-05 21:33:54 INF [plejd-ble] onDeviceConnected()
2023-06-05 21:33:54 DBG [plejd-ble] Device /org/bluez/hci0/dev_CC_62_11_C0_EB_34, {"deviceId":"CC6211C0EB34","siteId":"d60a8237-0ff1-4766-a95c-6a0629ab992c","title":"Kjøkkenlys","traits":11,"hiddenFromRoomList":false,"roomId":"a7f398ae-b446-4bab-ad2c-c5d9b1286280","createdAt":"2022-12-17T17:13:26.374Z","updatedAt":"2022-12-17T17:13:52.329Z","hiddenFromIntegrations":false,"outputType":"LIGHT","ACL":{},"objectId":"Oe9hiCccjJ","__type":"Object","className":"Device"}
2023-06-05 21:33:54 VRB [plejd-ble] Iterating connected devices looking for org.bluez.GattCharacteristic1
2023-06-05 21:33:54 VRB [plejd-ble] Interfaces /org/bluez: ["org.freedesktop.DBus.Introspectable","org.bluez.AgentManager1","org.bluez.ProfileManager1"]
2023-06-05 21:33:54 VRB [plejd-ble] Interfaces /org/bluez/hci0: ["org.freedesktop.DBus.Introspectable","org.bluez.Adapter1","org.freedesktop.DBus.Properties","org.bluez.BatteryProviderManager1","org.bluez.GattManager1","org.bluez.AdvertisementMonitorManager1","org.bluez.Media1","org.bluez.NetworkServer1","org.bluez.LEAdvertisingManager1"]
2023-06-05 21:33:54 VRB [plejd-ble] Interfaces /org/bluez/hci0/dev_CC_62_11_C0_EB_34: ["org.freedesktop.DBus.Introspectable","org.bluez.Device1","org.freedesktop.DBus.Properties"]
2023-06-05 21:33:54 VRB [plejd-ble] Characteristics found: []
2023-06-05 21:33:54 WRN [plejd-ble] Wasn't able to connect to Plejd, will retry.

Running on a RasPi3, using the onboard BT Home Assistant 2023.5.3 Supervisor 2023.04.1 Operating System 10.1

I've since attempted to downgrade both Core, supervisor and the OS several versions, but the error still occurs, so maybe it's not related to the update..? So really not sure what has changed.. The Plejd actuator did not get power-cycled before it happened (but I have restarted it afterwards, to check if that fixed the issue)

Any help is greatly appreciated!

arneroen commented 1 year ago

I got an external BT unit (ASUS USB-BT500), and tried using it. Initially, I saw the same errors, but then it suddenly found the characteristics it was looking for, and was able complete the connection...! I retried (power-cycled the raspi), and I had to manually power-cycle the BT device (bluetoothctl power off and bluetoothctl power on), after which it immediately was able to set up the connection.

I removed the BT adapter, and tried the same with the built-in raspi BT adapter, without luck. When i power-cycled the raspi, re-adding the external BT adapter, the add-on was able to power right up, setting up the connection without having to power-cycle the adapter (bluetoothctl power off and on).

So, no idea what's going on, but replacing the built-in raspi BT adapter that has been working for half a year seems to have fixed the issue. 🤷