Skip to content

Integration failing to connect: ERROR: Connection to Cync server reset, restarting in 15 seconds #144

@xpucu

Description

@xpucu

Hello! I just installed your integration to add my two Cync bulbs (WIFI) to HA. The authentication worked fine and I can see my devices, but I cannot control them :(

The first WARNING message indicates that the certificate cannot be validated and that the integration is disabling SSL:

2025-06-19 04:03:19.512 WARNING (Thread-696 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection problem, disabling SSL verification
Traceback (most recent call last):
  File "/config/custom_components/cync_lights/cync_hub.py", line 451, in _connect
    self.reader, self.writer = await asyncio.open_connection(
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        "cm.gelighting.com", 23779, ssl=context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        lambda: protocol, host, port, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1187, in create_connection
    transport, protocol = await self._create_connection_transport(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        ssl_shutdown_timeout=ssl_shutdown_timeout)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 1220, in _create_connection_transport
    await waiter
  File "/usr/local/lib/python3.13/asyncio/sslproto.py", line 581, in _on_handshake_complete
    raise handshake_exc
  File "/usr/local/lib/python3.13/asyncio/sslproto.py", line 563, in _do_handshake
    self._sslobj.do_handshake()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/ssl.py", line 951, in do_handshake
    self._sslobj.do_handshake()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'cm.gelighting.com'. (_ssl.c:1028)

And the message is actually true, they seem to be using a cert that expired in 2021 & for a different hostname...

Image

I do have a connection to the URL over the port though:

telnet cm.gelighting.com 23779
Trying 35.196.85.236...
Connected to cm-iot-ge.xlink.cloud.
Escape character is '^]'.

Immediately after this message I get a TCP error, indicating that the connection to GE was reset and it just goes in a loop trying to connect and repeating the WARNING and ERROR posted above

2025-06-19 04:03:04.317 ERROR (Thread-696 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Detected code that calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state. Please report this issue
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 239, in _report_usage
    integration_frame = get_integration_frame(
        exclude_integrations=exclude_integrations
    )
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 130, in get_integration_frame
    raise MissingIntegrationFrame
homeassistant.helpers.frame.MissingIntegrationFrame

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

Traceback (most recent call last):
  File "/config/custom_components/cync_lights/cync_hub.py", line 501, in _connect
    result = task.result()
  File "/config/custom_components/cync_lights/cync_hub.py", line 824, in _update_state
    dev.publish_update()
    ~~~~~~~~~~~~~~~~~~^^
  File "/config/custom_components/cync_lights/cync_hub.py", line 1452, in publish_update
    self._update_callback()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1018, in async_write_ha_state
    report_non_thread_safe_operation("async_write_ha_state")
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 402, in report_non_thread_safe_operation
    report_usage(
    ~~~~~~~~~~~~^
        f"calls {what} from a thread other than the event loop, "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        custom_integration_behavior=ReportBehavior.ERROR,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 202, in report_usage
    future.result()
    ~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 456, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 68, in run_callback
    future.set_result(callback(*args))
                      ~~~~~~~~^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 243, in _report_usage
    _report_usage_no_integration(what, core_behavior, breaks_in_ha_version, err)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/frame.py", line 373, in _report_usage_no_integration
    raise RuntimeError(msg) from err
RuntimeError: Detected code that calls async_write_ha_state from a thread other than the event loop, which may cause Home Assistant to crash or data to corrupt. For more information, see https://developers.home-assistant.io/docs/asyncio_thread_safety/#async_write_ha_state. Please report this issue
2025-06-19 04:03:04.320 ERROR (Thread-696 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection to Cync server reset, restarting in 15 seconds
2025-06-19 04:03:07.718 ERROR (MainThread) [homeassistant.components.alexa_devices] Unexpected error fetching [email protected] data
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 382, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/alexa_devices/coordinator.py", line 54, in _async_update_data
    return await self.api.get_devices_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aioamazondevices/api.py", line 700, in get_devices_data
    entity_ids_list = await self._get_devices_ids()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/aioamazondevices/api.py", line 541, in _get_devices_ids
    self._devices[serial_number] |= {NODE_IDENTIFIER: identifier}
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: 

My system:

System Information

version core-2025.6.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.13.3
os_name Linux
os_version 6.12.25-haos-raspi
arch aarch64
timezone America/Phoenix
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 4982
Installed Version 2.0.5
Stage running
Available Repositories 2052
Downloaded Repositories 218
Home Assistant Cloud
logged_in true
subscription_expiration June 6, 2026 at 5:00 PM
relayer_connected true
relayer_region
remote_enabled true
remote_connected true
alexa_enabled true
google_enabled true
cloud_ice_servers_enabled true
remote_server
certificate_status ready
instance_id
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 16.0.rc1
update_channel beta
supervisor_version supervisor-2025.06.0
agent_version 1.7.2
docker_version 28.0.4
disk_total 116.6 GB
disk_used 24.4 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization
board rpi5-64
supervisor_api ok
version_api ok
i
Dashboards
dashboards 11
resources 127
views 105
mode storage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions