Configuration error with Harmony remote

I’m trying to adapt from a YouTube video to manage the two way issues from Harmony Remote Hub but not sure if this is even going to work - however I’m getting the below error message:

end of the stream or a document separator is expected at line 31, column 1:
- id: harmony_sync_power_off
^

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Text to speech
tts:
  - platform: google_translate
  
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml


device_tracker:
  - platform: iphonedetect
    consider_home: 60
    scan_interval: 12
    new_device_defaults:
      track_new_devices: true
    hosts:
      hostname1: 192.168.1.125
      hostname2: 192.168.1.146
      
media_player:
  - platform: samsungtv
    host: 192.168.1.237


- id: harmony_sync_power_off
  alias: Harmony Sync Power Off
  trigger:
    platform: state
    entity_id: media_player_samsung_q80_65
    from: "on"
    to: "off"
  condition:
    - condition: state
      entity_id: remote.living_room_remote
      state: "on"
  action:
    - service: remote.turn_off
      entity_id: remote.living_room_remote
      
      
# - In your setup you may have activites where your reciever is on but your TV is off
#   such as listening to music, in that case you will use this automation
# - We will specify two triggers, the TV turning off and the reciever turning off. The
#   automation will trigger when either the TV or the reciever turns off however, in 
#   addition we will specify condtion that both the reciever and TV have to be off
# - Thus this automation will turn the harmony off if both the reciever and TV have been
#   turned off
- id: harmony_sync_power_off
  alias: Harmony Sync Power Off
  trigger:
    - platform: state
      entity_id: media_player_samsung_q80_65
      from: "on"
      to: "off"
    - platform: state
      entity_id: media_player.rx_a2060_dc8d51
      from: "on"
      to: "off"  
  condition:
    - condition: state
      entity_id: remote.living_room_remote
      state: "on"
    - condition: state
      entity_id: media_player_samsung_q80_65
      state: "off"
    - condition: state
      entity_id: media_player.rx_a2060_dc8d51
      state: "off" 
  action:
    - service: remote.turn_off
      entity_id: remote.living_room_remote


# - In the next automations, we will assign the harmony the correct activity based
#   on the current selected input of the reciever. If you use your TV for switching
#   instead of your reciver, the only thiing that needs to be changed is the entity
#   id should be changed to be your TV
# - Note you should check using developer tools what each input is called
# - The condtion is defined similar to the last automation to ensure the automation
#   doesn't trigger when it doesn't have too.
- id: switch.watch_a_dvd_harmony_activity
  alias: Eathc a DVD
  trigger:
    platform: state
    entity_id: media_player.rx_a2060_dc8d51
    attribute: source
    to: "Blu-ray"
  condition:
    - condition: not
      conditions:
        - condition: state
          entity_id: remote.living_room_remote
          attribute: current_activity
          state: "Watch a Movie"
  action:
    - service: remote.turn_on
      entity_id: remote.living_room_remote
      data:
        activity: "Watch a Movie"

- id: switch.watch_apple_tv_harmony_activity
  alias: Watch Apple Tv
  trigger:
    platform: state
    entity_id: media_player.rx_a2060_dc8d51
    attribute: source
    to: "Media Player"
  condition:
    - condition: not
      conditions:
        - condition: state
          entity_id: remote.living_room_remote
          attribute: current_activity
          state: "Watch Apple TV"
  action:
    - service: remote.turn_on
      entity_id: remote.living_room_remote
      data:
        activity: "Watch Apple TV"
        
- id: switch.living_room_remote_watch_tv
  alias: Watch Sky Q
  trigger:
    platform: state
    entity_id: media_player.rx_a2060_dc8d51
    attribute: source
    to: "Sky Q"
  condition:
    - condition: not
      conditions:
        - condition: state
          entity_id: remote.living_room_remote
          attribute: current_activity
          state: "Watch Sky Q"
  action:
    - service: remote.turn_on
      entity_id: remote.living_room_remote
      data:
        activity: "Watch Sky Q"        
        

Any advice appreciated

This line:

automation: !include automations.yaml

instructs Home Assistant that automations are located in a separate file called automations.yaml.

That’s where you should have put your five automations. However, you put them directly within the configuration.yaml. Move them to automations.yaml.

Note:
That file is also used to store automations created via the UI-based Automation Editor. The moment you use the Editor to create or modify an automation, upon saving it will remove all comments you have added.

If you don’t want that to happen, you should keep the automations you create with a text editor separate from the ones created with the Automation Editor. To do that, follow the instructions here.

Thank you so much

You’re welcome!

Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions. For more information refer to guideline 21 in the FAQ.