AppDaemon - secret file not working [Solved]


Here is my setup for AppDaemon, under the folder “appdaemon” there is a folder named “apps”. I am creating a new folder for each app and each app specific folder contains two files:

  1. app code file containing python script
  2. app yaml file

Here is code for Ecowater Softner app:

#Ecowater Softner App Settings
  module: ecowater
  class: EcoWater
  ecowater_minutes: 60
  ecowater_dsn: !secret ecowater_dsn
  ecowater_email: !secret ecowater_email
  ecowater_password: !secret ecowater_password

The above code works if I put the actual values of emails, password and DSN but my setup seems to be not able to read “secrets.yaml”. Here is the actual error code from logs:

ValueError: ecowater_dsn not found in secrets file

Here is my appdaemon.yaml file:

secret: /config/secrets.yaml
  latitude: <blanked>
  longitude: <blanked>
  elevation: 2
  time_zone: <blanked>
      type: hass      
  certfile: fullchain.pem
  keyfile: privkey.pem
  cert_verify: True
token: !secret mqtt_broker_token

  type: mqtt
  verbose: True

Any pointers as to what I might be doing wrong with my setup?

I did a fresh install on a Pi4 just to test out of box default settings of appdaemon.yaml:

secrets: secrets.yaml
  latitude: 52.379189
  longitude: 4.899431
  elevation: 2
  time_zone: America/Pacific
      type: hass

Added following to app.yaml:

  module: hello
  class: HelloWorld
  #phrase: "Wrong Option!!" !secret secret1
  phrase: !secret phrase

And here is secrets.yaml:

phrase: "Tell me a secret!!"

AppDaemon shows this error in the logs:

ValueError: phrase not found in secrets file

So something seemed messed up in the AppDaemon package as even the default configurations does not seem to work.

I think you can only use secrets in the appdaemon.yaml file. Otherwise try to put an additional secrets.yaml file in the apps directory and see if this resolves the issue.

Based on the documentation, I thought otherwise - see below. Thanks

1 Like

I assume you restarted after adding the changes? Do the secrets work in the appdaemon.yaml file?

I reported the above details on github and got this message :grinning:

Franck Nijhof <[email protected]> Unsubscribe
3:02 AM (2 minutes ago)
to hassio-addons/repository, me, Author

This is not the add-on repository, secondly, add-ons wrap software. Please report your issue with AppDaemon itself with the AppDaemon project.

@frenck I’ve no idea what it means as I am not a programmer, I am a DIY enthusiast aspiring to be a geek one day :sunglasses: Please ignore if the details were not relevant, I think I saw a problem so reported it and that is all.


You reported the issue on the add-on, but you need to report the issue in the repo of appdaemon.
The add-on is only a wrapper for the app, so that it can be used with Home Assistant easily (most configuration is done for you by the add-on).

Thanks :smiley:

Just submitted this -

1 Like

and it should also not be on the appdeamon github.
because it works.

you got 2 ways to use secrets

  1. you use a secrets file in the appdaemon configuration area. just using
secrets: secrets.yaml

will do in that case.

  1. you use another secrets file. (for example HAs secret file) to make that work you need to make 2 things sure:
    a) provide the COMPLETE path to the file (or else AD doesnt know where the file lives)
    b) make sure that the filerights from the file are so that AD is allowed to read them.

i dont use hassio, so i dont know the exact path from the HA secrets file (not a relative path) but im pretty sure that its not /config
im also not sure if AD has rights to read the secrets.yaml file from HA, but that is no concern from AD, but something that is part from HA.

to conclude: its working, but you are doing something wrong or HA has disabled it for you.


Thanks Rene for the explanation and it has solved my problem :smiley:

Really appreciate your input, have a great rest of the year and a very happy 2021 :wave: :clap:

1 Like

I get AppDaemon: could not determine a constructor for the tag '!secrets’

I added:
appdaemon.yaml: secrets: /config/secrets.yaml
apps.yaml: token: !secrets my_token
my_app.yaml: self.arg["token"]

config is most likely not a root directory.
thats why AD cant find it.

you will need the complete path, or just place it inside the appdaemon config area (side by side with appdaemon.yaml) and dont provide a path.

How can I find the complete path?

by looking at the complete directory structure from the HD/SD/SSD that your installation is on.
i dont know how and if its possible in hassio/hassos though

I had similar issues and restarting AppDaemon (from the add-on tab) did the trick for me and AD started seeing the secret.yaml file.