def setup_switch(device_id, name, insteonhub, hass, add_devices_callback):
 if (device_id in _CONFIGURING):
  request_id = _CONFIGURING.pop(device_id)
  configurator = get_component('configurator')
  configurator.request_done(request_id)
  _LOGGER.info('Device configuration done!')
 conf_switch = config_from_file(hass.config.path(INSTEON_LOCAL_SWITCH_CONF))
 if (device_id not in conf_switch):
  conf_switch[device_id] = name
 if (not config_from_file(hass.config.path(INSTEON_LOCAL_SWITCH_CONF), conf_switch)):
  _LOGGER.error('Failed to save configuration file')
 device = insteonhub.switch(device_id)
 add_devices_callback([InsteonLocalSwitchDevice(device, name)])

def setup_switch ( device_id , name , insteonhub , hass , add_devices_callback ) : if ( device_id in _CONFIGURING ) : request_id = _CONFIGURING . pop ( device_id ) configurator = get_component ( 'configurator' ) configurator . request_done ( request_id ) _LOGGER . info ( 'Device configuration done!' ) conf_switch = config_from_file ( hass . config . path ( INSTEON_LOCAL_SWITCH_CONF ) ) if ( device_id not in conf_switch ) : conf_switch [ device_id ] = name if ( not config_from_file ( hass . config . path ( INSTEON_LOCAL_SWITCH_CONF ) , conf_switch ) ) : _LOGGER . error ( 'Failed to save configuration file' ) device = insteonhub . switch ( device_id ) add_devices_callback ( [ InsteonLocalSwitchDevice ( device , name ) ] )
set up the switch .