Config Error Help

I have just created two new scripts and associated automations, but when I check config in Dev Tools I keep getting this error which I don’t understand:

Logger: homeassistant.config
Source: config.py:820
First occurred: 10:52:36 AM (5 occurrences)
Last logged: 12:30:25 PM

Invalid config for [script]: expected a dictionary. Got OrderedDict([('default_config', {}), ('media_source', {}), ('tts', [OrderedDict([('platform', 'google_translate')])]), ('group', OrderedDict([('battery_levels', OrderedDict([('name', 'Battery Levels'), ('entities', ['sensor.living_room_sensor_battery', 'sensor.kitchen_sensor_battery', 'sensor.staircase_sensor_battery', 'sensor.guest_room_dimmer_battery_level', 'sensor.living_room_dimmer_battery_level', 'sensor.master_bedroom_dimmer_battery_level', 'sensor.landing_sensor_battery'])])), ('doors.... (See /config/configuration.yaml, line 12).

I have no scripts with any of the above entities and have commented out the new scripts and automations but still receive the error so I’m confused and don’t know what the above is referring to and would appreciate any help.

My configuration.yaml line 12 is automation: !include automations.yaml

OK, so I don’t know if I’m on the right track but I believe the error above relates to this automation:

- alias: All Lights & Powerpoints Off
  id: all_lights_and_powerpoints_off
  mode: single
  trigger:
  - platform: template
    value_template: '{{ is_state("sensor.iphone_m_battery_state", "Charging")
        and is_state("sensor.iphone_r_battery_state", "Charging") }}'
  condition:
  - condition: time
    after: '20:00:00'
    before: '06:00:00'
  action:
  - service: script.goodnight

What I’m intending is when both phones go on to charging between 8pm and 6am, all lights and powerpoints should be turned off.

Is there anything wrong with this automation?

script:

goodnight:
  alias: Goodnight
  sequence:
  - service: light.turn_off
    data:
      entity_id: all
      transition: 10
  - service: switch.turn_off
    data:
      entity_id: switch.power_outlets
  mode: single
  icon: mdi:bed

Power Outlets Group (in configuration.yaml)

switch:
  - platform: group
    name: "Power Outlets"
    entities:
      - switch.accessory_powerpoint
      - switch.master_bedroom_freshener
      - switch.landing_freshener
      - switch.kitchen_freshener
      - switch.battery_charger
      - switch.front_door_powerpoint
      - switch.living_room_freshener

What change you make that start issue

It says check line 12 of config. Error is there or before in config. Specifically points to problem with switch but this may/may not be related

EDIT
I hate autocorrect on iPhone
“switch” should have been “script”

I think I’ve literally just figured out what was causing the errors and it has nothing to do with what was stated in the logs.

configuration.yaml line 12 is automation: !include automations.yaml

However, I had another script that had a dash (-) in front of alias that shouldn’t have been there. I had that particular script commented out for a while and only removed the comments (#) earlier today.

So, the log didn’t accurately point to the relevant script/automation, but I’ve found that’s usually the case.

Frustrating when it tells you there’s an error but can’t pinpoint it.