Vaskivskyi / ha-chroma

Control your Chroma-enabled devices from Home Assistant
Apache License 2.0
23 stars 0 forks source link

[Bug] "Failed setup, will retry" #62

Open justalemon opened 9 months ago

justalemon commented 9 months ago

The problem

I tried to set up the Chroma integration but I got hit with a "Failed setup, will retry" message with nothing in the logs.

Your device(s) with a problem

N/A

Firmware version

3.34.00

Integration version with the issue

0.2.2

Method of the integration installation

HACS

What version and type of Home Assistant installation do you use

Docker 2023.11.0

Is there anything useful in the logs?

No logging about HA Chroma

Additional information

No response

Alfy1080 commented 9 months ago

Exact same issue happens to me. I have added the inbound rule for port 54236 in Windows Firewall and restarted both home assistant and the computer where razer synapse is installed. I get no entry in the logs related to Chroma.

Vaskivskyi commented 8 months ago

Hello. Unfortunately, I had no free time to work on the Chroma integration before. I will try to solve the issues reported by the users shortly

justalemon commented 8 months ago

If you need help testing, feel free to ping me. Ill be happy to help :)

Gabrielabdo222 commented 7 months ago

Exact same issue happens to me. I have added the inbound rule for port 54236 in Windows Firewall and restarted both home assistant and the computer where razer synapse is installed. I get no entry in the logs related to Chroma.

22/1/2024 same today.

graywizardx commented 7 months ago

I took a quick look at this error for me at least, it looks like some kind of SSL error, untrusted cert maybe?

import asyncio import aiochroma chroma = AIOChroma('localhost', ['mousepad'], 'en-US')

Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 446, in result return self.get_result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio\main__.py", line 34, in callback coro = func() File "", line 1, in NameError: name 'AIOChroma' is not defined

chroma = aiochroma.AIOChroma('localhost', ['mousepad'], 'en-US') Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 439, in result return self.get_result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio__main__.py", line 34, in callback coro = func() File "", line 1, in File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiochroma\aiochroma.py", line 56, in init__ raise ChromaUnknownLayout(layout) aiochroma.error.ChromaUnknownLayout: ('en-US', None) chroma = aiochroma.AIOChroma('localhost', ['mousepad'], 'EN_US') async chroma.connect()

File "", line 1 async chroma.connect() ^ SyntaxError: invalid syntax

chroma.connect() Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 446, in result return self.get_result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio__main.py", line 34, in callback coro = func() File "", line 1, in AttributeError: 'AIOChroma' object has no attribute 'connect' async.run(chroma.connect()) File "", line 1 async.run(chroma.connect()) ^ SyntaxError: invalid syntax await chroma.connect() Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 446, in result return self.get_result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "", line 1, in AttributeError: 'AIOChroma' object has no attribute 'connect' await chroma.async_connect() Traceback (most recent call last): File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\connector.py", line 992, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio\base_events.py", line 1090, in create_connection transport, protocol = await self._create_connection_transport( File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio\base_events.py", line 1120, in _create_connection_transport await waiter File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio\sslproto.py", line 534, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\asyncio\sslproto.py", line 188, in feed_ssldata self._sslobj.do_handshake() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\ssl.py", line 945, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unhandled critical extension (_ssl.c:1129)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiochroma\connection.py", line 81, in async_request async with method( File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\client.py", line 1194, in aenter self._resp = await self._coro File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\client.py", line 578, in _request conn = await self._connector.connect( File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\connector.py", line 911, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\connector.py", line 1235, in _create_direct_connection raise last_exc File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\connector.py", line 1204, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiohttp\connector.py", line 994, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host localhost:54236 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unhandled critical extension (_ssl.c:1129)')]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 446, in result return self.get_result() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64qbz5n2kfra8p0\lib\concurrent\futures_base.py", line 391, in get_result raise self._exception File "", line 1, in File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiochroma\aiochroma.py", line 91, in async_connect await self._connection.async_identify() File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiochroma\connection.py", line 158, in async_identify result = await self.async_get(URL_MAIN) File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiochroma\connection.py", line 125, in async_get return await self.async_request(endpoint, self._session.get, payload, interval) File "C:\Users\William Howell\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\aiochroma\connection.py", line 99, in async_request raise ChromaError("Cannot connect to the Chroma SDK") from ex aiochroma.error.ChromaError: ('Cannot connect to the Chroma SDK', None)

graywizardx commented 7 months ago

Looks like the cert on the endpoint is no longer valid or is locally issued: Common Name (CN) Razer Chroma SDK Organization (O) Organizational Unit (OU) Common Name (CN) Razer Chroma SDK Local Cert Organization (O) Razer Inc Organizational Unit (OU) Chroma Issued On Saturday, January 13, 2024 at 10:58:34 PM Expires On Monday, January 13, 2025 at 10:58:34 PM Certificate fbbe8c6123cfec52552f9441e086f06be63d7542f1313509d839cdada262828a Public Key 3a876e9d80728771eff025a68cafa6c838a8349dd262870df970ca8a4c810d97

Might need to tell the library to pull the chain from somewhere, or to ignore it (not recommended)

xTim18 commented 6 months ago

Running into the same issue after updating to 0.3.0 to fix connection loss issue. Any updates or solutions about this?

graywizardx commented 6 months ago

You can manually edit the plugin to disable the SSL check if you feel its safe on your network. I dont have a patch handy that would be sufficient to submit.

Vaskivskyi commented 5 months ago

Hello. Sorry for the late reply.

In some cases there might be not a certificate issue, but rather an SSL protocol error (because of how good the Chroma and Synapse is made). Unfortunately, in this case it won't be possible to connect to Chroma SDK. The integration anyway does not check the certificate itself (because it's always issued locally and cannot be actually checked)

You can check this by connecting to the chroma SDK from the device running it (Synapse) using the address https://chromasdk.io:54236/razer/chromasdk (or its own IP address instead of chromasdk.io, but be sure to keep the correct port and https)

It should show chroma versions:

{
    "core": "3.34.02",
    "device": "3.34.02",
    "version": "3.34.02"
}

In case the SSL protocol works fine, you will just get a warning that certificate is not trusted, but can still get the same page with the SDK versions. But it might be that the browser will just show a ERR_SSL_PROTOCOL_ERROR message and won't be able to connect at all. In this case the only option is to find the version of Chroma / Synapse that works for you.

It definitely does not seem to work with the new Chroma Beta / Synapse Beta versions - the SSL is never operational there for me (regardless of how many times and versions I tried).

With Synapse 3 it is still possible to find a correct version or just reinstall Chroma Connect module a couple of times to get it working.

P.S. Unfortunately, Chroma SDK can only be accessed remotely using SSL connection. And with an SSL error in their own SDK there is little that can be done to fix it. Just to try to overcome it

Tomanic-glitch commented 5 months ago

I experience the same issue and I get the following error when trying both with https://chromasdk.io:54236/razer/chromasdk or the IP address - NET::ERR_CERT_INVALID

On the other hand, when trying with https://localhost:54235/razer/chromasdk the Chroma versions show up.

Failed_setup_will_retry ChromaSDK io IP_address localhost_54235