Where to find the content of the configuration file

Hi,
I am new to HA and struggle to understand where configuration data is stored. I get the impression that the development of HA is moving so fast that information in documentation and forums rapidly becomes obsolete. The basic problem I am trying to solve is to take snapshot from a camera. This should be simple and I manage to setup the automation to the point where I need to add/modify the allowlist_external_dirs for the dir where the images shall be stored. According to : Camera - Home Assistant this shall be done in the configuration.yaml. I am running Home Assistant OS 9.0 and the configuration directory is /config. However the configuration file here is almost empty and I canā€™t find all the information that the documentation refers to, see Setup basic information - Home Assistant. This is all the content:
image

Via the GUI I have defined name: latitude: longitude: and all that stuff, but it doesnā€™t appear in the configuration file, where is it stored now? And where can I add the ā€˜allowlist_external_dirsā€™ statement.
I find it really confusing.

Any pointer is welcome, thanks!

The most UI stuff you will find in the .storage directory.

External directories can be included this way:


homeassistant:
  name: !secret home_location
  latitude: !secret home_lat
  longitude: !secret home_lon

## and so onā€¦ ##

  allowlist_external_dirs:
    - /config

# https://www.home-assistant.io/integrations/default_config/
automation: !include automations.yaml
config:
counter:

## again and so onā€¦ ##

Thanks for your reply.
I donā€™t see any .yaml files in the directory .storage. The closest I get is a core.config file with json content.

I didnā€™t said this :slight_smile: Those a .json files. Editing while HA is running at oneā€™s own risk.

The allowlist (see my example above) goes into the configuration.yaml file.

OK, I see, thanks. So this means by default there is not even a /config entry under allowlist_external_dirs: ? at least not in the latest HA OS. As shown above my configuration.yaml is almost empty, does not even contain the top statement ā€˜homeassistant:ā€™ as in your code.
So my updated configuration.yaml file would be:

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

homeassistant:

  allowlist_external_dirs:
    - /config
    - /config/Photos
# the directory Photos is where the images are stored

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Tried, but I still get the error:
"Stopped because an error was encountered at October 2, 2022, 12:07:34 AM (runtime: 0.01 seconds)
extra keys not allowed @ data[ā€˜fileā€™] "

Yes, because you had all to begin with HA in the configuration.yaml. Everything else is optional.

The homeassistant: section in my file exists because I configured those parameters via .yaml and not via UI - thatā€™s all.

Rename your folder with lowercase and try again.

Have you restarted HA after making the change to the config?

Thanks for your input.
I updated the directory name to lowercase in the configuration.yaml file, automation.yaml file and in the file system. Restarted HA, but unfortunately I get the same error. This is what the files looks like:
configuration.yaml

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

homeassistant:
  allowlist_external_dirs:
    - /config
    - /config/photos

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

automation.yaml:

  action:
  - service: camera.snapshot
    target:
      entity_id: camera.ttgo_cam1
    data:
      file: '/config/photos/camera_ttgo.jpg'

I tried to change the file: format with/with out ā€˜ā€™, only the filename etc. but nothing helps. The error remains the same ā€œextra keys not allowed @ data[ā€˜fileā€™]ā€.

I finally solved the problem. I went via the GUI to the Automations, opened the Visual editor and removed the action and saved. Then opened it again and added the snapshot service. First I tested with a trivial filename and later added the below which includes date and time in the filename. I found the feature in the Visual Editor which allow you to run the action useful since it gives you direct feedback if the action is OK or not. The order of data and target has changed, but I tested and it doesnā€™t matter. Anyway this is how the .yaml code looks like. So in the end I donā€™t understand what went wrong, there is a bit of ā€œblack magicā€ in Home Assistantā€¦ :slight_smile: Sometimes good to delete and start overā€¦

service: camera.snapshot
data:
  filename: /config/photos/ttgo_cam1_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
target:
  entity_id: camera.ttgo_cam1

look at the difference between the two code configs.

Bad:

service: camera.snapshot
target:
  entity_id: camera.ttgo_cam1
data:
  file: '/config/photos/camera_ttgo.jpg'

good (reordered for clarity):

service: camera.snapshot
target:
  entity_id: camera.ttgo_cam1
data:
  filename: /config/photos/ttgo_cam1_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg

look at the last line in each. You should see the difference (hint: it has nothing to do with adding the timestamp).

thereā€™s no ā€œblack magicā€ involved.

I see the point, filename vs file :slight_smile: Thanks for pointing out.

1 Like