Automation for recording RTSP

Hello, I need some help to set up my very first automation with hassio.
I have a Tapo C200 camera, successfully integrated that transmit and RTSP correctly.
Now I would like to set up and automation, in order to register the stream on a MP4 file, in some hours of the day.
I modified the automation.yaml file in the following way:
'automation rec_fish:

  • trigger:
    • platform: time_pattern
      hours: “19”
      minutes: “59”
      seconds: “00”
      action:
      • service: camera.record
        target:
        entity_id: camera.tapo_c200
        data:
        duration: 180
        filename: “/tmp/prova.mp4”’

but there are some errors.
Here are the logs when I start the hassio:
‘2023-05-05 20:13:14.365 ERROR (MainThread) [homeassistant.components.automation] Unnamed automation could not be validated and has been disabled: extra keys not allowed @ data[‘automation rec_fish’]. Got [{‘trigger’: [{‘platform’: ‘time_pattern’, ‘hours’: ‘19’, ‘minutes’: ‘59’, ‘seconds’: ‘00’}], ‘action’: [{‘service’: ‘camera.record’, ‘target’: {‘entity_id’: ‘camera.tapo_c200’}, ‘data’: {‘duration’: 180, ‘filename’: ‘/tmp/prova.mp4’}}]}]
required key not provided @ data[‘action’]. Got None
required key not provided @ data[‘trigger’]. Got None’

Anyone could help me?
Regards,
Andrea

Hello,
Maybe it’s only the access to write to the tmp folder , this can be enabled by editing configuration.yaml:

homeassistant:
allowlist_external_dirs:
- /config/tmp/

when you post code here, please format it properly so we can read it reasonably. here’s info o how:

for what you’re doing, i think you can do it all (or very close to all) via the ui. especially if you’ve not built automation before, you should use the ui if you can. i don’t see anything here that you couldn’t do in the ui. and it will save you from formatting issues.

given what you’ve posted, i’m guessing that you have your whole action block indented. it should line up right at the same level as trigger.