Confused about configuration.yaml vs automations.yaml

I created a switch in configuration.yaml. It shows up in the GUI, and I can click on it to say a message on my workstation:

switch:
- platform: command_line
        switches:
          speech_michalk:
            command_on: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa michalk@michalk-desktop spd-say hello
            command_off: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /config/ssh/id_rsa michalk@michalk-desktop spd-say goodbye

I then installed the Bluetooth addon to discover my phone. An Icon representing my phone shows up and changes state when I turn bluetooth on or off:

device_tracker:
  - platform: bluetooth_tracker

Next, in the hassio web interface, I tried to add an automation, and this is not working. Here’s my automations.yaml

    - id: '1530999026445'
      alias: Brian's Phone Left
      trigger:
      - entity_id: device_tracker.brians_oneplus
        from: home
        platform: state
        to: not_home
      condition: []
      action:
      - alias: ''
        data: {}
        service: speech_michalk.turn_off
    - id: '1530999130303'
      alias: Brian's Phone Arrived
      trigger:
      - entity_id: device_tracker.brians_oneplus
        from: '''not_home'''
        platform: state
        to: '''home'''
      condition: []
      action:
      - alias: ''
        data:
          entity_id: switch.speech_michalk
        service: switch.turn_on

I’ve read other examples that don’t use an automation. Do I need an automation? If this all goes into configuration.yaml, what would the entry look like?

I have it working now through trial and error. Here is the automations.yaml file that works:

  • id: ‘1530999026445’
    alias: Brians Phone Left
    trigger:
    entity_id: device_tracker.brians_oneplus
    platform: state
    from: home
    to: not_home
    condition: []
    action:
    service: switch.turn_off
    entity_id: switch.speech_michalk
  • id: ‘1530999130302’
    alias: Brians Phone Arrived
    trigger:
    entity_id: device_tracker.brians_oneplus
    platform: state
    from: not_home
    to: home
    condition: []
    action:
    service: switch.turn_on
    entity_id: switch.speech_michalk