Make a file available to an AppDaemon app in Hass.io?

Does anyone know if it’s possible to put a file where AppDaemon runs as a Hass.io addon?

I have an AppDaemon app that uses the Spotify API, and during the initial authentication, it’s required that a URL is opened in a browser to obtain a token. This isn’t possible in the context of AppDaemon. In the past, when I was running Hassbian, I authenticated through the browser locally, then placed a token cache file where AppDaemon was running, which allowed it to use my cached token rather than need to authenticate through the browser.

I have a new cache file, but I’m not sure how I can make that file available to my script while it’s running in AppDaemon. Does anyone know if this is possible?

Hi @astone, not sure if this topic is still of interest to you. I tested the below and it works

  1. Create a cache file via the HA GUI (File Editor) and store the file in appropriate directory
    /config/appdaemon/apps/myapp/.cache

  2. In your appdaemon app code, you can fetch it using get_cached_token function

sp_oauth = SpotifyOAuth(client_id=cid, client_secret=secret, redirect_uri=redirect_uri, scope=scope, cache_path='/config/appdaemon/apps/myapp/.cache')
token_info = self.sp_oauth.cache_handler.get_cached_token()
atoken = self.token_info['access_token']
pspotify = spotipy.Spotify(auth=atoken)