    def apply_scanner_selection(self, closest_scanner: BermudaDeviceScanner | None):
        """
        Given a DeviceScanner entry, apply the distance and area attributes
        from it to this device.

        Used to apply a "winning" scanner's data to the device for setting closest Area.
        """
        # FIXME: This might need to check if it's a metadevice source or dest, and
        # ensure things are applied correctly. Might be a non-issue.
        old_area = self.area_name
        if closest_scanner is not None and closest_scanner.rssi_distance is not None:
            # We found a winner
            self.area_scanner = closest_scanner
            self.area_id = closest_scanner.area_id
            self.area_name = closest_scanner.area_name
            self.area_distance = closest_scanner.rssi_distance
            self.area_rssi = closest_scanner.rssi
            self.area_last_seen = closest_scanner.area_name
        else:
            # Not close to any scanners, or closest scanner has timed out!
            self.area_scanner = None
            self.area_id = None
            self.area_name = None
            self.area_distance = None
            self.area_rssi = None

        if (old_area != self.area_name) and self.create_sensor:
            _LOGGER.debug(
                "Device %s was in '%s', now '%s'",
                self.name,
                old_area,
                self.area_name,
            )
Given a DeviceScanner entry, apply the distance and area attributes
from it to this device.

Used to apply a "winning" scanner's data to the device for setting closest Area.
custom_components/bermuda/bermuda_device.py