def cmd_connect(self, *args):
    if ((len(args[0][0]) < 4) and self.last_scan):
        try:
            dev_id = (int(args[0][0]) - 1)
            entry = self.last_scan.devices[dev_id]
            mac_address = entry.addr
            addr_type = entry.addrType
        except Exception:
            logger.error('Bad ID / MAC address : {}'.format(args[0][0]))
            return False
    else:
        addr_type = None
        mac_address = args[0][0]
    self._magic_blue = MagicBlue(mac_address, version=self._bulb_version, addr_type=addr_type)
    self._magic_blue.connect(self.bluetooth_adapter)
    logger.info('Connected')
def cmd_connect(self, *args):
    if ((len(args[0][0]) < 4) and self.last_scan):
        try:
            dev_id = (int(args[0][0]) - 1)
            entry = self.last_scan.devices[dev_id]
            mac_address = entry.addr
            addr_type = entry.addrType
        except Exception:
            logger.error('Bad ID / MAC address : {}'.format(args[0][0]))
            return False
    else:
        addr_type = None
        mac_address = args[0][0]
    self._magic_blue = MagicBlue(mac_address, version=self._bulb_version, addr_type=addr_type)
    self._magic_blue.connect(self.bluetooth_adapter)
    logger.info('Connected')