Need some help with my first automations

Hi,

I’ve finally got my Home-Assistant install and all hardware talking to each other, but now I want to move on to automating some of the components together. I’m trying to get a few lights to turn on when door sensors are tripped, and as well adjust the lighting depending on the Kodi conditions I have set. The automations I have set up in the .yaml files seems to be registering fine, as HA produces no errors on them at boot (some other errors relating to Owntracks, but that’s another issue).

The scripts pass .yaml parsing, but for some reason they just don’t work. Could someone please take a look and tell me what I could be doing wrong please?

Here is my configuration.yaml file

homeassistant:

Name of the location where Home Assistant is running

name: Home

Location required to calculate the time the sun rises and sets

latitude: xx,xxxx
longitude: xx.xxxx

C for Celsius, F for Fahrenheit

temperature_unit: C

Pick yours from here: List of tz database time zones - Wikipedia

time_zone: America/xxxx
customize: !include customize.yaml

Track the sun

sun:

Show links to resources in log and frontend

#introduction:

Checks for available updates

updater:

Allows you to issue voice commands from the frontend

conversation:

Enables the frontend

frontend:

Prediction of weather

sensor:
platform: yr

Discover some devices automatically

discovery:

Enables support for tracking state changes over time.

history:

View all events in a logbook

logbook:

camera: !include cameras.yaml

media_player: !include media_players.yaml

notify: !include notify.yaml

device_tracker: !include trackers.yaml

zone: !include zones.yaml

group: !include groups.yaml

switch: !include switches.yaml

#CloudMQTT Location Tracker
mqtt:
broker: m10.cloudmqtt.com
port: 18924
client_id: home-assistant-1
keepalive: 60
username: home-assistant
password: xxxxx

mysensors Gateways
mysensors:
gateways:
- device: ‘/dev/ttyUSB0’
persistence_file: ‘/home/pi/.homeassistant/mysensors.json’
baud_rate: 115200
debug: true
persistence: true
version: ‘1.5’

#Speedtest
sensor speedtest:
platform: speedtest
minute: 00
hour:
- 0
- 6
- 12
- 18
monitored_conditions:
- ping
- download
- upload

automation: !include automation.yaml

script: !include scripts.yaml

And this is my automation.yaml file:

  • alias: ‘Man Cave Lamp On’
    trigger:
    platform: state
    entity_id: binary_sensor.man_cave_door_13_1
    state: ‘off’
    condition:
    condition: time
    after: ‘17:00:00’
    before: ‘02:00:00’
    action:
    service: switch.turn_on
    entity_id: switch.man_cave_lamp_4_1

  • alias: ‘Man Cave Lamp Off’
    trigger:
    platform: state
    entity_id: binary_sensor.man_cave_door_13_1
    state: ‘on’
    condition:
    condition: time
    after: ‘17:00:00’
    before: ‘02:00:00’
    action:
    service: switch.turn_off
    entity_id: switch.man_cave_lamp_4_1

  • alias: ‘Night Arrival Lighting’
    trigger:
    platform: state
    entity_id: binary_sensor.man_cave_door_12_1
    state: ‘on’
    condition:
    condition: time
    after: ‘18:00:00’
    before: ‘02:00:00’
    action:
    service: homeassistant.turn_on
    entity_id: group.living_room

  • alias: ‘Front Door Der’
    trigger:
    platform: state
    entity_id: binary_sensor.2_door_bellchime_monitor_2_0
    state: ‘on’
    action:
    service: notify.Der
    data:
    message: “Someone is at the back door!”
    title: “Home Assistant”

  • alias: ‘Front Door Ap’
    trigger:
    platform: state
    entity_id: binary_sensor.2_door_bellchime_monitor_2_0
    state: ‘on’
    action:
    service: notify.Ap
    data:
    message: “Someone is at the back door!”
    title: “Home Assistant”

  • alias: ‘Back Door Der’
    trigger:
    platform: state
    entity_id: binary_sensor.2_door_bellchime_monitor_2_1
    state: ‘on’
    action:
    service: notify.Der
    data:
    message: “Someone is at the front door!”
    title: “Home Assistant”

  • alias: ‘Back Door Ap’
    trigger:
    platform: state
    entity_id: binary_sensor.2_door_bellchime_monitor_2_1
    state: ‘on’
    action:
    service: notify.Ap
    data:
    message: “Someone is at the front door!”
    title: “Home Assistant”

  • alias: ‘LivingRoom Media Playing, Night’
    trigger:

    • platform: state
      entity_id: media_player.living_room_kodi
      from: ‘paused’
      to: ‘playing’
    • platform: state
      entity_id: media_player.living_room_kodi
      from: ‘idle’
      to: ‘playing’
      condition:
      condition: time
      after: ‘17:00:00’
      before: ‘02:00:00’
      action:
      service: script.media_playing_lr_night
  • alias: ‘LivingRoom Media Paused, Night’
    trigger:
    platform: state
    entity_id: media_player.living_room_kodi
    from: ‘playing’
    to: ‘paused’
    condition:
    condition: time
    after: ‘17:00:00’
    before: ‘02:00:00’
    action:
    service: script.media_paused_lr_night

Could someone please help me?

Thanks,

It is probably a copy/paste to formatting error when you posted to the site, but your spacing is all off. Without knowing how many spaces you have before each line I can’t begin to see what problem(s) exist.

As an example, I would need to see:

- alias:
  trigger:
    platform:

Quote your configurations in triple-backquotes, on a new line. Then we can inspect the spacing, which obviously is important in YAML!

Past your source like this so we can see your formatting and help you.