def start_scanning(config, add_entities, client):
 import pyflic
 scan_wizard = pyflic.ScanWizard()
 def scan_completed_callback(scan_wizard, result, address, name):
  'Restart scan wizard to constantly check for new buttons.'
  if (result == pyflic.ScanWizardResult.WizardSuccess):
   _LOGGER.info('Found new button (%s)', address)
  elif (result != pyflic.ScanWizardResult.WizardFailedTimeout):
   _LOGGER.warning('Failed to connect to button (%s). Reason: %s', address, result)
  start_scanning(config, add_entities, client)
 scan_wizard.on_completed = scan_completed_callback
 client.add_scan_wizard(scan_wizard)

def start_scanning ( config , add_entities , client ) : import pyflic scan_wizard = pyflic . ScanWizard ( ) def scan_completed_callback ( scan_wizard , result , address , name ) : if ( result == pyflic . ScanWizardResult . WizardSuccess ) : _LOGGER . info ( 'Found new button (%s)' , address ) elif ( result != pyflic . ScanWizardResult . WizardFailedTimeout ) : _LOGGER . warning ( 'Failed to connect to button (%s). Reason: %s' , address , result ) start_scanning ( config , add_entities , client ) scan_wizard . on_completed = scan_completed_callback client . add_scan_wizard ( scan_wizard )
start a new flic client for scanning & connceting to new buttons .