original_docstring: Set up the Wiser component.
docstring: Set up the Wiser component.
docstring_tokens: Set up the Wiser component .
code: async def async_setup_entry(hass, config_entry):
  
      """Set up the Wiser component."""
      if DOMAIN not in hass.data:
          hass.data[DOMAIN] = {}
  
      _LOGGER.info(
          "Wiser setup with Hub IP =  {} and scan interval of {}".format(
              config_entry.data[CONF_HOST], MIN_TIME_BETWEEN_UPDATES
          )
      )
  
      data = WiserHubHandle(
          hass,
          config_entry,
          config_entry.data[CONF_HOST],
          config_entry.data[CONF_PASSWORD],
      )
  
      @callback
      def retryWiserHubSetup():
          hass.async_create_task(wiserHubSetup())
  
      async def wiserHubSetup():
          _LOGGER.info("Initiating WiserHub connection")
          try:
              if await data.async_update(no_throttle=True):
                  if data.wiserhub.getDevices is None:
                      _LOGGER.error("No Wiser devices found to set up")
                      return False
  
                  hass.data[DOMAIN] = data
  
                  for platform in WISER_PLATFORMS:
                      hass.async_create_task(
                          hass.config_entries.async_forward_entry_setup(
                              config_entry, platform
                          )
                      )
  
                  _LOGGER.info("Wiser Component Setup Completed")
                  return True
              else:
                  await scheduleWiserHubSetup()
                  return True
          except (asyncio.TimeoutError):
              await scheduleWiserHubSetup()
              return True
          except WiserHubTimeoutException:
              await scheduleWiserHubSetup()
              return True
  
      async def scheduleWiserHubSetup(interval=30):
          _LOGGER.error(
              "Unable to connect to the Wiser Hub, retrying in {} seconds".format(
                  interval
              )
          )
          hass.loop.call_later(interval, retryWiserHubSetup)
          return
  
      hass.async_create_task(wiserHubSetup())
      await data.async_update_device_registry()
      return True
code_tokens: async def async_setup_entry ( hass , config_entry ) : if DOMAIN not in hass . data : hass . data [ DOMAIN ] = { } _LOGGER . info ( "Wiser setup with Hub IP =  {} and scan interval of {}" . format ( config_entry . data [ CONF_HOST ] , MIN_TIME_BETWEEN_UPDATES ) ) data = WiserHubHandle ( hass , config_entry , config_entry . data [ CONF_HOST ] , config_entry . data [ CONF_PASSWORD ] , ) @ callback def retryWiserHubSetup ( ) : hass . async_create_task ( wiserHubSetup ( ) ) async def wiserHubSetup ( ) : _LOGGER . info ( "Initiating WiserHub connection" ) try : if await data . async_update ( no_throttle = True ) : if data . wiserhub . getDevices is None : _LOGGER . error ( "No Wiser devices found to set up" ) return False hass . data [ DOMAIN ] = data for platform in WISER_PLATFORMS : hass . async_create_task ( hass . config_entries . async_forward_entry_setup ( config_entry , platform ) ) _LOGGER . info ( "Wiser Component Setup Completed" ) return True else : await scheduleWiserHubSetup ( ) return True except ( asyncio . TimeoutError ) : await scheduleWiserHubSetup ( ) return True except WiserHubTimeoutException : await scheduleWiserHubSetup ( ) return True async def scheduleWiserHubSetup ( interval = 30 ) : _LOGGER . error ( "Unable to connect to the Wiser Hub, retrying in {} seconds" . format ( interval ) ) hass . loop . call_later ( interval , retryWiserHubSetup ) return hass . async_create_task ( wiserHubSetup ( ) ) await data . async_update_device_registry ( ) return True
short_docstring: Set up the Wiser component.
short_docstring_tokens: Set up the Wiser component .
comment: """Set up the Wiser component."""