Skip to content

Commit

Permalink
fix issue when removing devices not present in duofern config.
Browse files Browse the repository at this point in the history
  • Loading branch information
gluap committed Dec 31, 2023
1 parent 7480585 commit 82aa335
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions custom_components/duofern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ async def async_remove_config_entry_device(
) -> bool:
"""Remove a config entry from a device."""
stick = getDuofernStick(hass)
try:
del (stick.duofern_parser.modules["by_code"][device_entry.name])
stick.config['devices'] = [dev for dev in stick.config['devices'] if dev['id'] != device_entry.name]
except:
logging.warning(device_entry)
logging.warning(device_entry.__dict__)
stick.sync_devices()
if device_entry.name in stick.duofern_parser.modules["by_code"]:
del stick.duofern_parser.modules["by_code"][device_entry.name]
stick.config['devices'] = [dev for dev in stick.config['devices'] if dev['id'] != device_entry.name]
return True


Expand Down

0 comments on commit 82aa335

Please sign in to comment.