Installing webcameras

I am trying to connect a D-Link DCS8000 webcam to my home assistant. The camera is RTSP compliant and although D-Link do not have their own HA integration it is possible to use the ONVIF integration. This works fine and I get a normal feed to HA and can add it to a Lovelace dashboard.

Amongst other functions I want to be able to use the camera to take snaphots and created an automatisation to do that. This is where my problems start! in the automation I am required to enter the Filename for the snapshot. On running the automation I get an error message

'Cannot write `https://XXX.duckdns.org:8123/config/local/tmp/Snapshots/Picture.jpg`, no access to path; `allowlist_external_dirs` may need to be adjusted in `configuration.yaml`

I understand that I need to create the destination folder in HA (which I have done) and also make an entry in my config.yaml fil something like:

allowlist_external_dirs:

- https://XXX.duckdns.org:8123/config/local/tmp/Snapshots/

I have tried a lot of different combinations for this adress, used www instead of local, with and without the duck.dns addition but cannot find the correct alternative. My belief is that the problems I am experiencing are due to Duck.dns. I reach my instance of HA both internally and externally via the duck.dns https address but cannot work out how to work around this in order to be able ot configure my camera which seems to have problems with the path alternatives I have tried.

Would very much appreciate suggestion or work arounds!

It would have helped us if you’d shared the automation, but you write to a file not a URL. For example /config/local/tmp/Snapshots/Picture.jpg

Thanks for your interest. here are some more details code etc…
Automation:

alias: Notice with picture
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.back_door_motion
    to: "on"
condition: []
action:
  - service: camera.snapshot
    data:
      filename: >-
        https://petergreenoriust.duckdns.org:8123/config/local/tmp/Snapshots/Picture.jpg
    target:
      entity_id: camera.webkam_brevladan_ovprofile00
mode: single

Nothing happens when I run the automation and if I run a trace Í get the following:

Adding the path in config.yaml looks like this:

and when I try to restart HA to make the change in config.yaml I get the following error message:

Grateful for any thoughts

that’s not a filename, that’s a URL

That is a filename.

Try

      filename: >-
        /config/local/tmp/Snapshots/Picture.jpg

Fine, I can change that in the automation no problem but running the automation I still get an error “no access to path; allowlist_external_dirs may need to be adjusted in configuration.yaml” I understand your advice about the formatting of the automation but how do I solve the error when I try to inset the Alowlist entry into my config.yaml file?

Then you have to add it under homeassistant::

homeassistant:
  allowlist_external_dirs:
    - "/config/local/"