def request_app_setup(hass, config, add_devices, config_path, discovery_info=None):
 configurator = get_component('configurator')
 def fitbit_configuration_callback(callback_data):
  'The actions to do when our configuration callback is called.'
  config_path = hass.config.path(FITBIT_CONFIG_FILE)
  if os.path.isfile(config_path):
   config_file = config_from_file(config_path)
   if (config_file == DEFAULT_CONFIG):
    error_msg = ("You didn't correctly modify fitbit.conf", ' please try again')
    configurator.notify_errors(_CONFIGURING['fitbit'], error_msg)
   else:
    setup_platform(hass, config, add_devices, discovery_info)
  else:
   setup_platform(hass, config, add_devices, discovery_info)
 start_url = '{}{}'.format(hass.config.api.base_url, FITBIT_AUTH_CALLBACK_PATH)
 description = 'Please create a Fitbit developer app at\n                       https://dev.fitbit.com/apps/new.\n                       For the OAuth 2.0 Application Type choose Personal.\n                       Set the Callback URL to {}.\n                       They will provide you a Client ID and secret.\n                       These need to be saved into the file located at: {}.\n                       Then come back here and hit the below button.\n                       '.format(start_url, config_path)
 submit = 'I have saved my Client ID and Client Secret into fitbit.conf.'
 _CONFIGURING['fitbit'] = configurator.request_config(hass, 'Fitbit', fitbit_configuration_callback, description=description, submit_caption=submit, description_image='/static/images/config_fitbit_app.png')

def request_app_setup ( hass , config , add_devices , config_path , discovery_info = None ) : configurator = get_component ( 'configurator' ) def fitbit_configuration_callback ( callback_data ) : config_path = hass . config . path ( FITBIT_CONFIG_FILE ) if os . path . isfile ( config_path ) : config_file = config_from_file ( config_path ) if ( config_file == DEFAULT_CONFIG ) : error_msg = ( "You didn't correctly modify fitbit.conf" , ' please try again' ) configurator . notify_errors ( _CONFIGURING [ 'fitbit' ] , error_msg ) else : setup_platform ( hass , config , add_devices , discovery_info ) else : setup_platform ( hass , config , add_devices , discovery_info ) start_url = '{}{}' . format ( hass . config . api . base_url , FITBIT_AUTH_CALLBACK_PATH ) description = 'Please create a Fitbit developer app at\n                       https://dev.fitbit.com/apps/new.\n                       For the OAuth 2.0 Application Type choose Personal.\n                       Set the Callback URL to {}.\n                       They will provide you a Client ID and secret.\n                       These need to be saved into the file located at: {}.\n                       Then come back here and hit the below button.\n                       ' . format ( start_url , config_path ) submit = 'I have saved my Client ID and Client Secret into fitbit.conf.' _CONFIGURING [ 'fitbit' ] = configurator . request_config ( hass , 'Fitbit' , fitbit_configuration_callback , description = description , submit_caption = submit , description_image = '/static/images/config_fitbit_app.png' )
assist user with configuring the fitbit dev application .