cync_lights icon indicating copy to clipboard operation
cync_lights copied to clipboard

Issue with Reauthorizing

Open pagedeskbill3 opened this issue 1 year ago • 9 comments

Hello! I commend you on a wonderful job here. I do have a quick question and am having an issue with Cync. Some of my lights will not respond within HA. So, in the process of authorizing, after putting in the 2FA code in I will receive an unknown error. I looked in the logs and I am receiving this error:

Logger: aiohttp.server Source: custom_components/cync_lights/config_flow.py:266 Integration: Cync Lights (documentation) First occurred: March 8, 2023 at 5:01:42 PM (4 occurrences) Last logged: 4:07:38 PM

Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 67, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 94, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 146, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 241, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper result = await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 271, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/cync_lights/config_flow.py", line 241, in async_step_two_factor_code return await self.async_step_select_switches() File "/config/custom_components/cync_lights/config_flow.py", line 266, in async_step_select_switches description = {"suggested_value" : [room for room in self.entry.options["subgroups"] if room in self.entry.data["cync_config"]["rooms"].keys()]}, KeyError: 'subgroups'

pagedeskbill3 avatar Mar 09 '23 22:03 pagedeskbill3

Same issue here. With basically the same log.

druid1302 avatar Mar 28 '23 02:03 druid1302

Same issue here too.

JoeG923 avatar Apr 04 '23 21:04 JoeG923

Same issue for me

cbrooker avatar Apr 05 '23 16:04 cbrooker

Can you clarify what you mean by "reauthorizing"? Did you delete the integration first, reinstall, and then reauthorize or did you use the "configure" button to reauthorize?

nikshriv avatar Apr 05 '23 18:04 nikshriv

Hello! I used the configure button to reauthorize. I was hesitant to reinstall if it caused issues with the other devices which are still working correctly. Thank you!

pagedeskbill3 avatar Apr 05 '23 18:04 pagedeskbill3

Yes, that makes sense. I had to make a couple of baking changes to handle subgroups some time ago. If you have updated to the most recent version but didn't alter your configuration, the integration would continue to work.

All you need to do to fix it is to delete your current configuration and add it again (re-login like you're installing for the first time). I think that should fix it.

nikshriv avatar Apr 06 '23 01:04 nikshriv

Maybe I am confused, however, how would you remove the configuration? Are you saying to delete the integration and add it again?

pagedeskbill3 avatar Apr 06 '23 02:04 pagedeskbill3

And just for clarification, I just removed the integration and installed again and the same error is occurring.

pagedeskbill3 avatar Apr 06 '23 03:04 pagedeskbill3

If you can run the two scripts in my cync_data repository and post your results, that would be helpful. Try that first. The parse_cync_data script will tell us if there is a problem with you Cync configuration data that is making the integration fail. Post the results of both scripts, and you might want to react any sensitive information first.

I think it's possible that your old config entry didn't get deleted when you upgraded to the latest version of the integration. You might have to install the version of the integration you had when you created that config entry to be able to delete it. Once the old entry is cleared out of your system, I think it will install properly.

nikshriv avatar Apr 06 '23 14:04 nikshriv