Closed CFenner closed 1 year ago
I created a new network with the same settings. but the api request gibts another type
now:
before:
{"id":"y","uuid":"y","name":"z","type":3,"grade":1}
now:
{"id":"x","uuid":"x","name":"Test2","type":2,"grade":1}
2022-12-25 01:39:41.400 INFO (MainThread) [CasambiBt._casambi] Trying to connect to casambi network x...
2022-12-25 01:39:41.401 INFO (MainThread) [CasambiBt._network] Getting network id...
2022-12-25 01:39:41.611 INFO (MainThread) [CasambiBt._network] Got network id x.
2022-12-25 01:39:41.613 INFO (MainThread) [CasambiBt._network] Logging in to network...
2022-12-25 01:39:41.651 INFO (MainThread) [CasambiBt._network] Login sucessful.
2022-12-25 01:39:41.652 INFO (MainThread) [CasambiBt._network] Saving session...
2022-12-25 01:39:41.654 INFO (MainThread) [CasambiBt._network] Updating network...
2022-12-25 01:39:41.699 INFO (MainThread) [CasambiBt._keystore] Added key Administratorpasswort with role 3 to store.
2022-12-25 01:39:41.699 INFO (MainThread) [CasambiBt._keystore] Saving keys...
2022-12-25 01:39:41.703 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 01:39:42.212 WARNING (MainThread) [CasambiBt._network] Unsupported control mode TEMPERATURE in fixture 22133.
2022-12-25 01:39:42.216 INFO (MainThread) [CasambiBt._network] Sucessfully fetched unit type.
2022-12-25 01:39:42.217 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 01:39:42.217 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 01:39:42.217 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 01:39:42.217 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 01:39:42.217 INFO (MainThread) [CasambiBt._network] Saving type cache...
2022-12-25 01:39:42.219 INFO (MainThread) [CasambiBt._network] Network updated.
2022-12-25 01:39:42.219 INFO (MainThread) [CasambiBt._client] Connection to x
2022-12-25 01:39:50.010 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-25 01:39:59.266 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-25 01:40:19.401 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-25 01:40:30.240 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-25 01:40:55.125 INFO (MainThread) [CasambiBt._casambi] Trying to connect to casambi network x...
2022-12-25 01:40:55.126 INFO (MainThread) [CasambiBt._network] Getting network id...
2022-12-25 01:40:55.315 INFO (MainThread) [CasambiBt._network] Got network id x.
2022-12-25 01:40:55.316 INFO (MainThread) [CasambiBt._keystore] Loading keys...
2022-12-25 01:40:55.317 INFO (MainThread) [CasambiBt._keystore] Loaded 1 keys.
2022-12-25 01:40:55.317 INFO (MainThread) [CasambiBt._network] Loading session...
2022-12-25 01:40:55.319 INFO (MainThread) [CasambiBt._network] Loading unit type cache...
2022-12-25 01:40:55.320 INFO (MainThread) [CasambiBt._network] Updating network...
2022-12-25 01:40:55.359 INFO (MainThread) [CasambiBt._keystore] Key with id 4 already exists. Skipping...
2022-12-25 01:40:55.359 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 01:40:55.359 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 01:40:55.359 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 01:40:55.360 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 01:40:55.360 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 01:40:55.360 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 01:40:55.360 INFO (MainThread) [CasambiBt._network] Saving type cache...
2022-12-25 01:40:55.361 INFO (MainThread) [CasambiBt._network] Network updated.
2022-12-25 01:40:55.362 INFO (MainThread) [CasambiBt._client] Connection to x
2022-12-25 01:41:04.194 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-25 01:41:42.835 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
Still I'm not able to setup the integration.
Great find with the network type. I also have type 2 but I can try to investigate what the type means and how the app handles the different types.
Regarding your current problem the issue seems to be that the bluetooth connection is never really established. Could you include debug logging for bleak_retry_connector? I'm somewhat confused though how https://github.com/lkempf/casambi-bt/blob/a4f1d503d7b1242344de547139e3072206c18404/src/CasambiBt/_client.py#L122 is never reached without printing an error into the log.
Do you have any docs for api.casambi.com
? Is this a legacy api as developer.casambi.com
only describes door.casambi.com
?
How do I activate debug logs for bleak_retry_connector
?
api.casambi.com
is the api used interally by the casambi app. I don't think there is any public documentation. I need to use that api since door.casambi.org
doesn't provide the information needed to authenticate a bluetooth connection with the network.
To change the log level in HA put the following into your configuration.yaml
:
logger:
default: info
logs:
CasambiBt: debug
bleak_retry_connector: debug
full debug log
2022-12-25 12:37:47.237 INFO (MainThread) [CasambiBt._casambi] Trying to connect to casambi network x...
2022-12-25 12:37:47.238 INFO (MainThread) [CasambiBt._network] Getting network id...
2022-12-25 12:37:47.421 INFO (MainThread) [CasambiBt._network] Got network id x.
2022-12-25 12:37:47.422 INFO (MainThread) [CasambiBt._keystore] Loading keys...
2022-12-25 12:37:47.424 INFO (MainThread) [CasambiBt._keystore] Loaded 1 keys.
2022-12-25 12:37:47.425 INFO (MainThread) [CasambiBt._network] Loading session...
2022-12-25 12:37:47.427 INFO (MainThread) [CasambiBt._network] Loading unit type cache...
2022-12-25 12:37:47.429 INFO (MainThread) [CasambiBt._network] Updating network...
2022-12-25 12:37:47.467 DEBUG (MainThread) [CasambiBt._network] Network: {"status":"FETCHED","revision":8.0,"network":{"id":"x","revision":8,"generation":1,"lastUsedProtocol":0,"channels":1561,"mode":1,"grade":1,"uuid":"x","gateway":{},"email":"x","name":"Test2","visitorKey":"x","managerKey":"x","type":2,"nextSceneID":0,"nextUnitID":3,"nextEventID":0,"nextControlID":0,"nextGroupID":0,"protocolVersion":11,"allUnitPosition":-1,"nearUnitPosition":-1,"nearbyEnabled":false,"allowPrototypes":false,"longitude":0.0,"latitude":0.0,"timeZone":"Europe/Berlin","settings":{"revision":1},"grid":{"type":0,"position":0,"groupID":0,"cells":[{"type":1,"position":0,"groupID":0,"unit":1},{"type":1,"position":1,"groupID":0,"unit":2},{"type":3,"position":2,"groupID":0},{"type":1,"position":3,"groupID":0,"unit":3}]},"photos":[],"units":[{"deviceID":1,"uuid":"x","address":"x","cpu":1,"name":"CURVED ","type":22133,"appearance":0,"hueID":0,"groupID":0,"position":0,"revision":1,"configRevision":1,"firmware":9472,"modes":[{"name":"unit_mode1","state":"80802e","cycle":true},{"name":"unit_mode2","state":"00002e","cycle":false},{"name":"unit_mode3","state":"00002e","cycle":false},{"name":"unit_mode4","state":"00002e","cycle":false}],"pushButtonToggleDisabled":false,"linkedSensor":0,"gain":100.0,"startupMode":0,"minOnLevel":0.0,"minLevel":0.0,"maxLevel":1.0,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":2,"uuid":"x","address":"x","cpu":1,"name":"CURVED ","type":22133,"appearance":0,"hueID":0,"groupID":0,"position":1,"revision":1,"configRevision":1,"firmware":9472,"modes":[{"name":"unit_mode1","state":"80802e","cycle":true},{"name":"unit_mode2","state":"00002e","cycle":false},{"name":"unit_mode3","state":"00002e","cycle":false},{"name":"unit_mode4","state":"00002e","cycle":false}],"pushButtonToggleDisabled":false,"linkedSensor":0,"gain":100.0,"startupMode":0,"minOnLevel":0.0,"minLevel":0.0,"maxLevel":1.0,"parameters":[],"sequenceCounter":0,"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]},{"deviceID":3,"uuid":"x","address":"x","cpu":1,"name":"CURVED ","type":22133,"appearance":0,"hueID":0,"groupID":0,"position":2,"revision":1,"configRevision":1,"firmware":9472,"modes":[{"name":"unit_mode1","state":"80802e","cycle":true},{"name":"unit_mode2","state":"00002e","cycle":false},{"name":"unit_mode3","state":"00002e","cycle":false},{"name":"unit_mode4","state":"00002e","cycle":false}],"pushButtonToggleDisabled":false,"linkedSensor":0,"gain":100.0,"startupMode":0,"minOnLevel":0.0,"minLevel":0.0,"maxLevel":1.0,"parameters":[],"behaviour":0,"timeout":0,"labels":{},"details":{},"actionConfig":0,"actions":[]}],"scenes":[],"events":[],"circadianProfiles":[],"keyStore":{"revision":2,"nextKeyID":5,"keys":[{"id":4,"type":0,"role":3,"name":"Administratorpasswort","key":"x"}]},"gwT1":0,"gwT2":0,"securityOptions":{"revision":3,"payloadSize":145,"saturation":60.0,"allowUnpair":true,"allowFlickUnpair":true,"allowAdminUnpair":true,"allowUpdates":true,"alwaysVisible":true,"enableDebugMode":false,"visibilityTime":15,"radioTxPower":0,"options":0}},"role":3}
2022-12-25 12:37:47.468 INFO (MainThread) [CasambiBt._keystore] Key with id 4 already exists. Skipping...
2022-12-25 12:37:47.468 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 12:37:47.469 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 12:37:47.469 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 12:37:47.469 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 12:37:47.469 INFO (MainThread) [CasambiBt._network] Fetching unit type for id 22133...
2022-12-25 12:37:47.469 INFO (MainThread) [CasambiBt._network] Using cached type.
2022-12-25 12:37:47.469 INFO (MainThread) [CasambiBt._network] Saving type cache...
2022-12-25 12:37:47.472 INFO (MainThread) [CasambiBt._network] Network updated.
2022-12-25 12:37:47.472 INFO (MainThread) [CasambiBt._client] Connection to x
2022-12-25 12:37:47.473 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 1
2022-12-25 12:38:06.326 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 1, last rssi: None)
2022-12-25 12:38:06.578 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 2
2022-12-25 12:38:15.029 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 2, last rssi: None)
2022-12-25 12:38:15.282 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 3
2022-12-25 12:38:21.685 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 3, last rssi: None)
2022-12-25 12:38:21.937 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 4
2022-12-25 12:38:31.670 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 4, last rssi: None)
2022-12-25 12:38:31.922 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 5
2022-12-25 12:38:43.454 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 5, last rssi: None)
2022-12-25 12:38:43.707 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 6
You might be running into https://github.com/hbldh/bleak/issues/993. It might help to capture a packet trace with btmon (see https://github.com/bluez/bluez/blob/master/monitor/btmon.rst for help using that) but I suspect that your issue is outside of my control. Does connecting to the network work with another Bluetooth adapter (possibly on another device)? There is a demo.py
script in the casambi-bt repo that can be used to test the library without HA.
I‘m Running HA on a rpi4 in the room below the Casambi light. But the Pi is in a server rack. For ZigBee and HomeMatic I have external antennas mounted to the rack but ble is builtin to the Pi. So probably this could cause connection issues, right?! Could an ESPHome device with Bluetooth proxy enabled help here?
Trying out the demo.py
now leads to this error 😢
$ python3 demo.py
Searching...
Discovered networt at C0CA0DF2-9E45-A8DE-85CE-574E56F5A580
Discovered networt at 6DB6A886-6520-546C-AF6E-4F75AF33D3E3
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at /Users/cfenner/git/private/casambi-bt/demo.py:10> exception=AttributeError("'__NSCFString' object has no attribute 'address'")>
Traceback (most recent call last):
File "/Users/cfenner/git/private/casambi-bt/demo.py", line 19, in main
print(f"[i]\t{d.address}")
AttributeError: '__NSCFString' object has no attribute 'address'
Now you're running into a bleak bug on Mac OS I think. The docs state that BleakScanner.discover
should return List[BleDevice]
but it seems to sneak in a string. I'll push a quick workaround for this.
Ok taking another look at this not after right after waking up it now seems to me that the bleak docs are still misleading but my workaround won't help. Do you have another device with linux and bluetooth? Otherwise I can try to work around the Mac OS quirks but this might take some debugging help from you.
Is the casambi-bt package outdated in the venv you're running demo.py
in? This would actually explain the error.
I have no idea about python, need to find out what venv
is first 😉
A venv is just a way to install different packages for different projects. If you installed casambi-bt globally just update it there.
Ok, I uninstalled and reinstalled casambi-bt
again. This time it works and I get this output:
$ python3 demo.py
Searching...
Discovered networt at E4D6BC1D-73E9-9BAC-A341-3792A970A491
Discovered networt at C0CA0DF2-9E45-A8DE-85CE-574E56F5A580
[0] E4D6BC1D-73E9-9BAC-A341-3792A970A491
[1] C0CA0DF2-9E45-A8DE-85CE-574E56F5A580
Select network: 1
Enter password: x
Trying to connect to casambi network C0CA0DF2-9E45-A8DE-85CE-574E56F5A580...
Getting network id...
Task exception was never retrieved
future: <Task finished name='Task-1' coro=<main() done, defined at /Users/cfenner/git/private/casambi-bt/demo.py:9> exception=NetworkNotFoundError('API failed to find network. Is your network configured correctly?')>
Traceback (most recent call last):
File "/Users/cfenner/git/private/casambi-bt/demo.py", line 28, in main
await casa.connect(device, pwd)
File "/opt/homebrew/lib/python3.10/site-packages/CasambiBt/_casambi.py", line 118, in connect
networkId = await getNetworkIdFromUuid(addr, self._httpClient)
File "/opt/homebrew/lib/python3.10/site-packages/CasambiBt/_network.py", line 277, in getNetworkIdFromUuid
raise NetworkNotFoundError(
CasambiBt.errors.NetworkNotFoundError: API failed to find network. Is your network configured correctly?
Is this the correct address format? It's not the colon-separated format I type in in HA. Also the API call does not work using this format.
That's a limitation of the Bluetooth stack on Mac OS. And I just noticed that this of course won't work since the Casambi Api needs the real MAC to look up the network. I think the easiest solution here would be to patch the call to getNetworkIdFromUuid in "/opt/homebrew/lib/python3.10/site-packages/CasambiBt/_casambi.py", line 118 with the MAC you used earlier hard-coded. It might also work if you hard-code your MAC in demo.py but I'm not sure about that.
I think that this is the only place the MAC is used outside of the Bluetooth stack but you might have to fix this issue multiple times.
Ok, hardcoding the MAC in demo.py
works, it's connecting and I see a luminaire data:
Unit(_typeId=22133, deviceId=1, uuid='x', address='x', name='CURVED ', firmwareVersion='9472', unitType=UnitType(id=22133, model='CURVED ', manufacturer='OLIGO', mode='PWM/4ch/Dim,Dim,TW', stateLength=3, controls=[UnitControl(type=<UnitControlType.DIMMER: 0>, offset=0, length=8, default=128, readonly=False), UnitControl(type=<UnitControlType.DIMMER: 0>, offset=8, length=8, default=128, readonly=False), UnitControl(type=<UnitControlType.UNKOWN: 99>, offset=16, length=8, default=46, readonly=False)]), _state=None, _on=False, _online=True)
I will now try to install a ble proxy via ESPHome to extend the range of the RPi4.
Still no luck, but new error messages, ESPHome bluetooth proxy is placed 2m away from the lights.
2022-12-26 23:13:16.527 INFO (MainThread) [CasambiBt._client] Connection to x
2022-12-26 23:13:16.528 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 1
2022-12-26 23:13:16.528 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 1, last rssi: None)
2022-12-26 23:13:20.530 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 2
2022-12-26 23:13:20.531 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 2, last rssi: None)
2022-12-26 23:13:24.533 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 3
2022-12-26 23:13:24.534 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 3, last rssi: None)
2022-12-26 23:13:28.536 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 4
2022-12-26 23:13:28.537 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 4, last rssi: None)
2022-12-26 23:13:32.539 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 5
2022-12-26 23:13:32.539 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 5, last rssi: None)
2022-12-26 23:13:36.564 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 6
2022-12-26 23:13:36.565 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 6, last rssi: None)
2022-12-26 23:13:40.569 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 7
2022-12-26 23:13:40.569 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 7, last rssi: None)
2022-12-26 23:13:44.572 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 8
2022-12-26 23:13:44.573 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 8, last rssi: None)
2022-12-26 23:13:48.576 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 9
2022-12-26 23:13:48.577 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found, backing off: 4.0 (attempt: 9, last rssi: None)
2022-12-26 23:13:52.578 ERROR (MainThread) [CasambiBt._client] Failed to find client.
File "/usr/local/lib/python3.10/site-packages/CasambiBt/_client.py", line 107, in connect
bleak_retry_connector.BleakOutOfConnectionSlotsError: Casambi Network - x: Failed to connect: No backend with an available connection slot that can reach address x was found: The proxy/adapter is out of connection slots; Add additional proxies near this device
Apparently the ESP Home proxy can only connect to one device at a time. Is there anything else it could be trying to connect to? Is HA running in parallel?
Is there anything else it could be trying to connect to?
I guess I have plenty of ble devices in my home, no idea, can I see this in the logs?
Is HA running in parallel?
What do you mean by that?
What do you mean by that?
I guess this doesn't make all that much sense if you are using HaOS but HA tends to break any other Bluetooth applications on my dev laptop. So if this is the result of running demo.py the cause might be that HA is running in parallel.
homeassistant.components.bluetooth
might log which adapter is used for which connection with log level debug. But I don't know if knowing this would actually help since there seems to be no way to tell HA to only use a proxy for a certain address. Do you have more ESP boards to throw at the problem?
Yes, just added another two. Further more will have to wait till tomorrow 😉
It might also be that the ESPs are crashing according to https://github.com/home-assistant/core/issues/79685. Maybe that issue can help.
I moved the RPi4 closer to the Casambi lights and now get some connections again. But it seems not to be recognized all the time.
2022-12-27 01:56:53.684 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] x (x): Switching from esphome-web-06ca64 to hci0 (x) [connectable] (new rssi:-86 - threshold:5 > old rssi:-95)
2022-12-27 01:56:53.684 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (x) [connectable]: x AdvertisementData(manufacturer_data={963: b'At\xa5L\xa2\xf1\n'}, service_uuids=['0000fe4d-0000-1000-8000-00805f9b34fb'], rssi=-86) match: {'casambi-bt'}
2022-12-27 07:40:15.375 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] Atom Netzwerkschrank (esphome-web-952154): 41:74:A5:4C:A2:F1 AdvertisementData(local_name='CURVED ', manufacturer_data={963: b'At\xa5L\xa2\xf1\n'}, service_uuids=['0000fe4d-0000-1000-8000-00805f9b34fb'], tx_power=-127, rssi=-90) match: set()
2022-12-27 07:40:56.411 DEBUG (MainThread) [homeassistant.components.bluetooth.manager] hci0 (E4:5F:01:95:6C:87) [connectable]: 41:74:A5:4C:A2:F1 AdvertisementData(local_name='CURVED ', manufacturer_data={963: b'At\xa5L\xa2\xf1\n'}, service_uuids=['0000fe4d-0000-1000-8000-00805f9b34fb'], rssi=-77) match: set()
I once made it past [CasambiBt._client] Connected to x
but failed afterwards. Most of the time the connection to the client is not possible.
2022-12-27 07:51:07.939 INFO (MainThread) [CasambiBt._network] Saving type cache...
2022-12-27 07:51:07.944 INFO (MainThread) [CasambiBt._network] Network updated.
2022-12-27 07:51:07.944 INFO (MainThread) [CasambiBt._client] Connection to x
2022-12-27 07:51:07.945 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 1
2022-12-27 07:51:18.742 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-27 07:51:18.743 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 1, last rssi: None)
2022-12-27 07:51:18.996 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 2
2022-12-27 07:51:26.760 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 2, last rssi: None)
2022-12-27 07:51:27.012 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 3
2022-12-27 07:51:32.597 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 3, last rssi: None)
2022-12-27 07:51:32.851 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 4
2022-12-27 07:51:35.549 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-27 07:51:35.551 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 4, last rssi: None)
2022-12-27 07:51:35.803 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 5
2022-12-27 07:51:37.769 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-27 07:51:37.771 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 5, last rssi: None)
2022-12-27 07:51:38.023 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 6
2022-12-27 07:51:40.446 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-27 07:51:40.449 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 6, last rssi: None)
2022-12-27 07:51:40.701 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 7
2022-12-27 07:51:44.730 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 7, last rssi: None)
2022-12-27 07:51:44.983 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 8
2022-12-27 07:51:51.832 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Failed to connect: [org.bluez.Error.Failed] le-connection-abort-by-local, backing off: 0.25 (attempt: 8, last rssi: None)
2022-12-27 07:51:52.084 DEBUG (MainThread) [bleak_retry_connector] Casambi Network - x: Connection attempt: 9
2022-12-27 07:51:56.296 INFO (MainThread) [CasambiBt._client] Connected to x
2022-12-27 07:51:56.296 INFO (MainThread) [CasambiBt._client] Starting key exchange...
2022-12-27 07:51:56.739 INFO (MainThread) [CasambiBt._client] Received disconnect callback from x
2022-12-27 07:51:56.744 ERROR (MainThread) [custom_components.casambi-bt.config_flow] Unexpected exception
File "/config/custom_components/casambi-bt/config_flow.py", line 119, in async_step_user
File "/config/custom_components/casambi-bt/config_flow.py", line 41, in _validate_input
File "/usr/local/lib/python3.10/site-packages/CasambiBt/_casambi.py", line 126, in connect
File "/usr/local/lib/python3.10/site-packages/CasambiBt/_casambi.py", line 137, in _connectClient
File "/usr/local/lib/python3.10/site-packages/CasambiBt/_client.py", line 136, in exchangeKey
I think this is just the Bluetooth connection failing later. Do you have a Bluetooth dongle and a USB extension cord lying around? That's what I'm using to work around connection issues with the built-in receiver in my RPi4. Not all dongles work well with HA so if you want to order one specifically you should choose one from the list on https://www.home-assistant.io/integrations/bluetooth/#known-working-adapters.
Oh and I use rfkill to force HA to use the dongle and not the built-in receiver but I don't know if this works on HaOS.
Got a Bluetooth dongle with external antenna. Works like a charm now.
Sorry for all the trouble.
Glad to have helped.
I set my network settings as described in https://github.com/lkempf/casambi-bt
When I try to setup the integration it fails while updating the network: ERROR 410: Gone
Do I need to make the network visible?
Do I need to use evolution or classic firmware?Found in another issue that you use evo as well..Logs: