Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config flow for multiple locks #49

Merged
merged 4 commits into from
Mar 5, 2024
Merged

Fix config flow for multiple locks #49

merged 4 commits into from
Mar 5, 2024

Conversation

raman325
Copy link
Owner

@raman325 raman325 commented Mar 2, 2024

This should fix #48

@tykeal can you confirm?

@raman325 raman325 added the bug Something isn't working label Mar 2, 2024
Copy link

codecov bot commented Mar 2, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 89.52%. Comparing base (4113bc7) to head (f77e3c2).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #49   +/-   ##
=======================================
  Coverage   89.51%   89.52%           
=======================================
  Files          19       19           
  Lines        1192     1193    +1     
=======================================
+ Hits         1067     1068    +1     
  Misses        125      125           
Files Coverage Δ
custom_components/lock_code_manager/config_flow.py 100.00% <100.00%> (ø)
custom_components/lock_code_manager/__init__.py 93.90% <0.00%> (ø)

@tykeal
Copy link
Contributor

tykeal commented Mar 4, 2024

Does not appear to have completely fixed the problem. I'm getting less spew but still getting something:

2024-03-04 06:01:39.151 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/lock_code_manager/__init__.py", line 348, in async_update_listener
    coordinator = hass_data[entry_id][COORDINATORS][lock_entity_id]
                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'lock.test_lock'

Current test configuration:

LCM Bob (why because Bob sounded good this time 😄 ) configured with slots 1 - 3. Slot 1 is configured completely manually, Slot 2 has a calendar attached to it, Slot 3 has a different calendar attached to it.

LCM is configured to use lock.test_lock

I verified that everything is working correctly.

I then added Foo configured to use lock.test_lock and configured slots 5 - 7, all configured manually.

I get the above error after adding it. It shows up as no devices or entities configured, it does however let me pull up the configuration now, which it wasn't doing before.

Removing this one gives me the following error:

2024-03-04 06:06:34.054 ERROR (MainThread) [homeassistant.config_entries] Error unloading entry Foo for lock_code_manager
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 605, in async_unload
    result = await component.async_unload_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/lock_code_manager/__init__.py", line 207, in async_unload_entry
    await async_unload_lock(hass, config_entry)
  File "/config/custom_components/lock_code_manager/__init__.py", line 190, in async_unload_lock
    hass_data[entry_id][COORDINATORS].pop(lock_entity_id)
KeyError: 'lock.test_lock'

Removing the working one (after removing the one that failed) gives no errors.

@raman325 raman325 added python Pull requests that update Python code minor Minor release labels Mar 5, 2024
@raman325
Copy link
Owner Author

raman325 commented Mar 5, 2024

how about now @tykeal ?

@tykeal
Copy link
Contributor

tykeal commented Mar 5, 2024

@raman325 That works great :)

@raman325 raman325 merged commit 10616f9 into main Mar 5, 2024
8 of 9 checks passed
@raman325 raman325 deleted the config_flow branch March 5, 2024 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor Minor release python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ISSUE: Adding another integration to control a different block of slots causes
2 participants