nikshriv / cync_lights

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

Error encountered with Multiple "Homes" in Cync App #25

Closed nonlinearsugar closed 1 year ago

nonlinearsugar commented 1 year ago

If I have a second "home" with zero devices, I get an error when trying to input my credentials in the HA integration after installation. After deleting the empty home, the error goes away.

Logger: custom_components.cync_lights.config_flow Source: custom_components/cync_lights/cync_hub.py:658 Integration: cync_lights (documentation) First occurred: 3:46:49 PM (4 occurrences) Last logged: 4:18:36 PM

Unexpected exception Traceback (most recent call last): File "/config/custom_components/cync_lights/config_flow.py", line 101, in async_step_two_factor_code info["data"]["cync_config"] = await self.cync_hub.get_cync_config() File "/config/custom_components/cync_lights/cync_hub.py", line 658, in get_cync_config bulbs_array_length = max([((device['deviceID'] % home['id']) % 1000) + (int((device['deviceID'] % home['id']) / 1000)*256) for device in home_info['bulbsArray']]) + 1 ValueError: max() arg is an empty sequence

nikshriv commented 1 year ago

Thanks for the info. I'll filter that out in the next version.

nikshriv commented 1 year ago

The integration has been updated to exclude empty homes.