Example #1
0
    def check_device(self, device):
        if device.client == None:
            self.info("found device %s of type %s - %r" %
                      (device.get_friendly_name(), device.get_device_type(),
                       device.client))
            short_type = device.get_friendly_device_type()
            if short_type in self.auto_client and short_type is not None:
                self.info("identified %s %r" %
                          (short_type, device.get_friendly_name()))

                if short_type == 'MediaServer':
                    client = MediaServerClient(device)
                if short_type == 'MediaRenderer':
                    client = MediaRendererClient(device)
                if short_type == 'BinaryLight':
                    client = BinaryLightClient(device)
                if short_type == 'DimmableLight':
                    client = DimmableLightClient(device)
                if short_type == 'InternetGatewayDevice':
                    client = InternetGatewayDeviceClient(device)

                client.coherence = self.coherence
                device.set_client(client)

        self.process_queries(device)
Example #2
0
    def check_device(self, device):
        if device.client is None:
            self.info(f'found device {device.get_friendly_name()} of type '
                      f'{device.get_device_type()} - {device.client}')
            short_type = device.get_friendly_device_type()
            if short_type in self.auto_client and short_type is not None:
                self.info(
                    f'identified {short_type} {device.get_friendly_name()}')

                if short_type == 'MediaServer':
                    client = MediaServerClient(device)
                if short_type == 'MediaRenderer':
                    client = MediaRendererClient(device)
                if short_type == 'InternetGatewayDevice':
                    client = InternetGatewayDeviceClient(device)
                client.bind(detection_completed=self.completed)
                client.coherence = self.coherence

                device.set_client(client)

        if device.client.detection_completed:
            self.completed(device.client)
        self.process_queries(device)