platypush/plugins/switchbot/bluetooth/__init__.py
def scan(self, interface: str = None, duration: int = 10) -> BluetoothScanResponse:
        """
        Scan for available Switchbot devices nearby.

        :param interface: Bluetooth interface to scan (default: default configured interface)
        :param duration: Scan duration in seconds
        """

        devices = super().scan(interface=interface, duration=duration).devices
        compatible_devices = {}

        for dev in devices:
            try:
                characteristics = [
                    chrc for chrc in self.discover_characteristics(
                        dev['addr'], channel_type='random', wait=False,
                        timeout=self.scan_timeout).characteristics
                    if chrc.get('uuid') == self.uuid
                ]

                if characteristics:
                    compatible_devices[dev['addr']] = None
            except Exception as e:
                self.logger.warning('Device scan error', e)

        return BluetoothScanResponse(devices=compatible_devices)

        Scan for available Switchbot devices nearby.

        :param interface: Bluetooth interface to scan (default: default configured interface)
        :param duration: Scan duration in seconds
        
Scan for available Switchbot devices nearby.
Scan for available Switchbot devices nearby .
def scan(self, interface: str = None, duration: int = 10) -> BluetoothScanResponse:
        devices = super().scan(interface=interface, duration=duration).devices
        compatible_devices = {}
        for dev in devices:
            try:
                characteristics = [
                    chrc for chrc in self.discover_characteristics(
                        dev['addr'], channel_type='random', wait=False,
                        timeout=self.scan_timeout).characteristics
                    if chrc.get('uuid') == self.uuid
                ]
                if characteristics:
                    compatible_devices[dev['addr']] = None
            except Exception as e:
                self.logger.warning('Device scan error', e)
        return BluetoothScanResponse(devices=compatible_devices)
def scan ( self , interface : str = None , duration : int = 10 ) -> BluetoothScanResponse : devices = super ( ) . scan ( interface = interface , duration = duration ) . devices compatible_devices = { } for dev in devices : try : characteristics = [ chrc for chrc in self . discover_characteristics ( dev [ 'addr' ] , channel_type = 'random' , wait = False , timeout = self . scan_timeout ) . characteristics if chrc . get ( 'uuid' ) == self . uuid ] if characteristics : compatible_devices [ dev [ 'addr' ] ] = None except Exception as e : self . logger . warning ( 'Device scan error' , e ) return BluetoothScanResponse ( devices = compatible_devices )
Scan for available Switchbot devices nearby.
Scan for available Switchbot devices nearby .
"""
        Scan for available Switchbot devices nearby.

        :param interface: Bluetooth interface to scan (default: default configured interface)
        :param duration: Scan duration in seconds
        """
self
interface
str
Bluetooth interface to scan (default: default configured interface)
Bluetooth interface to scan ( default : default configured interface )
duration
int
Scan duration in seconds
Scan duration in seconds