Skip to content

Commit

Permalink
Add method to clear devices from FreeAtHome class
Browse files Browse the repository at this point in the history
  • Loading branch information
kingsleyadam committed Oct 23, 2024
1 parent d34cf4d commit 359cfde
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/abbfreeathome/freeathome.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def __init__(
self._device_classes: list[Base] = device_classes
self._include_orphan_channels = include_orphan_channels

def clear_devices(self):
"""Clear all devices in the device list."""
self._devices.clear()

async def get_config(self, refresh: bool = False) -> dict:
"""Get the Free@Home Configuration."""
if self._config is None or refresh:
Expand Down Expand Up @@ -134,6 +138,7 @@ def get_device_by_class(self, device_class: Base) -> list[Base]:

async def load_devices(self):
"""Load all of the devices into the devices object."""
self.clear_devices()
for _mapping in self._get_function_to_device_mapping():
await self._load_devices_by_function(
_mapping.get("function"), _mapping.get("device_class")
Expand Down

0 comments on commit 359cfde

Please sign in to comment.