lkempf / casambi-bt-hass

27 stars 11 forks source link

ESPHome bluetooth_proxy: Bluetooth doesn't seem to work properly. #83

Open Strudsen opened 3 weeks ago

Strudsen commented 3 weeks ago

Describe the bug Error message: Bluetooth doesn't seem to work properly.

I try to use a esp32dev running ESPHome with the bluetooth_proxy module enabled. but it dont seems like the integration accept it as a adapter

could I provide some logs from the integration to debug this problem ?

Versions

mgoeller commented 3 weeks ago

@lkempf It would be interesting to re-write the python library so that it directly runs on an ESP32 with ESPHome. Basically Casambi Support for ESPHome.

stbuerger commented 3 weeks ago

In the beginning I had massive problems with esp32 BT-Proxy and Casambi. I actually had problems starting or re-starting the (Casambi) integration when esp32-btproxy where "alive" but not correctly working. It took me iterating through three different esp32 boards until I found one working (almost) stable. I still have "disconnects" to my Casambi network every other day. In most (8of10) cases I just have to do a reload of the integration via an automation I had set up. In seldom cases I have to reboot the esp32-btproy and then (after some 90 seconds) reload the integration.

Living with this pattern, I'm using the integration with 2x Casambi ("Occhio") lights for almost 4 month now - and I LOVE IT.

guardiande commented 3 weeks ago

@stbuerger - May I ask which Occhio models you're successfully using?

stbuerger commented 3 weeks ago

@stbuerger - May I ask which Occhio models you're successfully using?

1x Mito volo, 1x Mito raggio, 2x Mito soffito

guardiande commented 3 weeks ago

Thanks. Good to see the volo works because I was not able to get it working last time I tried. I'll have to try my sento also again.

guardiande commented 3 weeks ago

@stbuerger - I've tried it again with my Occhio Mito volo and the Sento and I still get this error:

raceback (most recent call last):
  File "/config/custom_components/casambi_bt/config_flow.py", line 144, in async_step_user
    info = await _validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/casambi_bt/config_flow.py", line 59, in _validate_input
    await casa.connect(bt_device, data[CONF_PASSWORD])
  File "/usr/local/lib/python3.12/site-packages/CasambiBt/_casambi.py", line 147, in connect
    await self._connectClient()
  File "/usr/local/lib/python3.12/site-packages/CasambiBt/_casambi.py", line 158, in _connectClient
    raise e
  File "/usr/local/lib/python3.12/site-packages/CasambiBt/_casambi.py", line 154, in _connectClient
    await self._casaClient.exchangeKey(self._casaNetwork.getKeyStore())  # type: ignore[union-attr]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/CasambiBt/_client.py", line 158, in exchangeKey
    raise ProtocolError(
CasambiBt.errors.ProtocolError: Unexpected answer from device! Wrong device or protocol version?

Which I think goes back to the fact that both lamps use the classic protocol.

Can you please have a look at your Casambi app and let me know the details for your lamps? At least on iOS, start the app, go to "More" (Mehr) then "Close by Devices" (Geräte in der Nähe). This lists my devices and states that all are using the classic protocol (e.g. Classic/26.42).

Thanks!

lkempf commented 3 weeks ago

There is currently no support for networks using the classic firmware

guardiande commented 3 weeks ago

I knew this but thought that the model defined whether you have the classic or the Evolution firmware. Thanks to @stbuerger , I figured that I can switch to the Evolution firmware. My lamps are accessible from HA now. :)

Thanks, @lkempf for this integration!

m0uH commented 2 weeks ago

How can I get the integration running with a bluetooth_proxy only? I always get complains about missing Bluetooth adapters. My Home-Assistant is running on a server, such that any USB Bluetooth adapter would be too far away.

stbuerger commented 2 weeks ago

Works ootb with btproxy. Finding a good working esp32 hw for btproxy can sometimes be a bit tricky.