hellqvio86 / home_assistant_casambi

Home assistant Integration for Casambi Cloud lights
MIT License
25 stars 9 forks source link

Integration crashes after a few minutes #103

Closed Virtualizer closed 6 months ago

Virtualizer commented 6 months ago

Hi,

I use the integration with my iPhone as Gateway. After each HA restart, the Integration does work. When running for a few minutes, suddenly the integration crashes with the following log-entries:

Logger: py.warnings
Source: runner.py:189
First occurred: 12:50:13 PM (1 occurrences)
Last logged: 12:50:13 PM

/usr/local/lib/python3.12/asyncio/events.py:88: RuntimeWarning: coroutine 'CasambiController.async_reconnect' was never awaited self._context.run(self._callback, *self._args)

and

This error originated from a custom integration.

Logger: aiocasambi.websocket
Source: custom_components/casambi/casambi/CasambiController.py:56
integration: Casambi (documentation, issues)
First occurred: 12:49:43 PM (2 occurrences)
Last logged: 12:49:43 PM

websocket caught ConnectionError inwebsocket.send_message Cannot write to closing transport

Additionally, sometimes my network goes crazy (e.g. lights are stuck on specific state) until I restart the network manually. Could be another Casambi cloud related topic, though.

CFenner commented 6 months ago

I had issues with the phone as gateway integration as well. I think the device and app must always be awake to work properly. I can recommend to use BT if you have that on your hardware: https://github.com/lkempf/casambi-bt-hass

Virtualizer commented 6 months ago

Yes, my phone is not always online, so it's not really ready for production use. Will have a look into the BT integration. The latter does directly communicate with the controllers via BT, so no cloud involved? Do you have experience regarding the range of the BT communication (HA-box runs in another room on the same level)?

CFenner commented 6 months ago

Do you have experience regarding the range of the BT communication (HA-box runs in another room on the same level)?

My HA is in the basement and the casambi light in the room above. This works well, but you could also use espHome BT proxy to extend the range. But I guess this also depends on your walls 😉

The latter does directly communicate with the controllers via BT, so no cloud involved?

Yes, that was my main point to change. ☁️ 🔫

Virtualizer commented 6 months ago

Ok thanks for the information. One last question: Do you have a BT adapter in the HA box, if so what's the model? Will have to get an USB BT adapter as my box has no built-in BT controller.

Additionally, will I have to configure the Bluetooth integration in HA first (before installing the Casambi-BT integration)?

hellqvio86 commented 6 months ago

I suggest to go to a bluetooth adapter unless you run the legacy/classic firmware (its not supported by casambi-bt yet).

Otherwise please update your integration and enable debug logging, I just released a new version, I can't really test it end-to-end since I no longer run a casambi gateway.

Virtualizer commented 6 months ago

Ok, thanks for the additional info. Indeed, I'm on the legacy/classic firmware. Didn't mess with the firmwares until now. I can test the new version with the phone gateway and check if there are any changes regarding the crashes, but I think the BT integration will be the better choice longterm-wise.

Update: Opened "nearby devices" in the Casambi app and my network is going crazy again. I think I will remove the cloud and gateway features and go with the BT route.

Virtualizer commented 6 months ago

Update: Upgraded my controllers and network to evo FW, Installed an USB BT adapter and integrated the Casambi-BT integration to HA. It's working right now, without cloud. No misbehavior of the network like when activating the Phone gateway. It's bad, that I can't provide additional information to the resolution of this issue, though. I think it's best to close this issue then.