Help with my YAML automation

Hi all

I’ve just started trying to do some work using ymal and while my first try worked, my latest try isn’t working.

What I want to do is when my washing machine or dryer finishes its cycle, I want various Alexa’s to sound a bell and then say that the job is done. To practice, I decided to use the bathroom exhaust fan turning on as the trigger; I want to play a joke on the kids when they go to use the toilet lol

This is what I have done. It’s a mixture of a various examples that I’ve found here, which is probably half my problem, but without a step by step, I’m just trying to learn as I go.

alias: TEST
description: ""
trigger:
  - platform: device
    type: turned_on
    device_id: ae82586b8ddeefa80ec5085a1693a81c
    entity_id: a1a40a1e4510d59e2008007c91b45a9a
    domain: switch
condition:
  - condition: time
    after: "08:00:00"
    before: "21:00:00"
    weekday:
      - sat
      - fri
      - thu
      - wed
      - tue
      - mon
      - sun
action:
  sequence:
    - service: media_player.volume_set
      data:
        entity_id: media_player.bathroom,media_player.cinema,media_player.ensuite,media_player.entryway,media_player.garage,media_player.kitch,media_player.main_bedroom
        volume_level: '0.8'
    - delay: '00:00:02'
    - service: media_player.play_media
      data:
        target:
          - media_player.bathroom,media_player.cinema,media_player.ensuite,media_player.entryway,media_player.garage,media_player.kitch,media_pl
        media_content_type: sound
        media_content_id: bell_02
    - service: notify.alexa_media
      data:
        target:
          - media_player.bathroom,media_player.cinema,media_player.ensuite,media_player.entryway,media_player.garage,media_player.kitch,media_pl
        message: haha someone is using the toilet hahahaha
      data:
        type: tts
      
mode: single

I hope it makes enough sense. Thanks in advance for anyone’s help!

Your example contains about 6 errors (possibly more) so I recommend you use the Automation Editor to compose your automation instead of attempting to create it directly in YAML.

After you create the automation using the Automation Editor’s visual mode, you can switch it to YAML mode to see how it appears (as valid, error-free YAML). That’s one way to become familiar with how valid YAML is composed before attempting to create an automation directly in YAML.

Thank you for your tip! I did first try to do this the normal way (as in not in ymal) but I couldn’t figure out how to do it. But your tip suggests that it should be possible so that’s really great! I’ll give it another go, but from everything I’ve read so far, I haven’t seen at least how to adjust the volume without using code.

Edit: everything prior to the ACTION was done the normal way. After completing it that way, I then switched to ymal. Pretty scary to know that there are that many errors just in the section that I tried to do!