nikshriv / cync_lights

Home Assistant Integration for controlling Cync switches, plugs, and bulbs
160 stars 53 forks source link

Connection to Cync server reset, restarting in 15 seconds #21

Open johnrosshunt opened 1 year ago

johnrosshunt commented 1 year ago

Hi, thanks for creating this integration.

The response is immediate when turning devices on and off, adjusting brightness, etc. That part works great!

But, there are problems with Cync's rooms & groups. Any operation on a room or group results in the following:

image

There are also syncing issues. A device often toggles back to it's previous setting in 3-5 seconds when toggling a switch or light from the dashboard. I'm guessing it has something to do with the messages from my home-assistant.log file:

2022-11-01 17:18:55.604 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] KeyError: None 2022-11-01 17:18:55.605 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection to Cync server reset, restarting in 15 seconds 2022-11-01 17:19:17.621 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] KeyError: None 2022-11-01 17:19:17.622 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection to Cync server reset, restarting in 15 seconds 2022-11-01 17:19:39.641 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] KeyError: None 2022-11-01 17:19:39.642 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection to Cync server reset, restarting in 15 seconds 2022-11-01 17:20:01.660 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] KeyError: None 2022-11-01 17:20:01.662 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection to Cync server reset, restarting in 15 seconds 2022-11-01 17:20:23.250 ERROR (Thread-2 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] ShuttingDown: 2022-11-01 17:20:23.493 WARNING (Thread-13 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] ZeroDivisionError: division by zero 2022-11-01 17:20:23.498 WARNING (Thread-13 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] ZeroDivisionError: division by zero 2022-11-01 17:20:25.229 ERROR (Thread-13 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] KeyError: None 2022-11-01 17:20:25.231 ERROR (Thread-13 (_start_tcp_client)) [custom_components.cync_lights.cync_hub] Connection to Cync server reset, restarting in 15 seconds

Let me know what additional information I can provide to help. Thanks!

nikshriv commented 1 year ago

Can you explain I'm more detail what operation you are performing on the "room/group". Are you referring to the room entities that are created by the integration? Are the individual switches working but the rom switches are not?

Also, you need to run the my cync_data.py script and post your result (hide any sensitivity info before posting).

johnrosshunt commented 1 year ago

I'm referring to rooms & groups as defined by the Cync app. For example, my bedroom is set up like this:

Room view (Cync app): Screenshot_20221103-155106

Group view (Cync app): Screenshot_20221103-155114

The rooms & groups defined by Cync are added as devices in HA: Screen Shot 2022-11-04 at 2 29 18 PM 2 41 39 PM

And also entities: Screen Shot 2022-11-04 at 2 48 26 PM

How it all looks from the dashboard: Screen Recording 2022-11-04 at 3 00 52 PM

If I toggle the "Cync Room" or "Cync Group" entities the error message from the first post is displayed & the lights don't change. However, if I toggle the HA Area or HA Light Group then the lights will also toggle. But, the dashboard doesn't always reflect changes to the entity's state. As you can see, sometimes entities don't toggle at all or will "spring back" after a few seconds.

Neither Google Home nor Alexa support rooms, groups & scenes defined by Cync. When you add Cync to one of those integrations, you get the lights, switches, sensors etc., but not the rooms, groups & scenes. Perhaps that is what your integration should do as well?

Finally, here's cbyge_rooms.json: cbyge_rooms.json.gz

nikshriv commented 1 year ago

Sorry for the delay getting back to you. Busy schedule lately, and I took a bit of a break from updating this integration. I preliminarily looked through your configuration, and I believe your issues are related to the use of subgroups. I have not used subgroups in my setup, so did not design the integration around that. I will look at this in more detail and get back to you.

nikshriv commented 1 year ago

Support for groups has been added. Please give it a try. You will have to delete your current installation and reinstall the integration, then sign in again. Let me know if this fixes your issue.