Automation to play a sound when door sensor is triggered

@jbardi - hey, that “i” is much easier than looking at the log directly, hehe. This is my only automation and I did have a bootstrap error!

16-08-29 08:42:18 homeassistant.bootstrap: Invalid config for [automation]: expected str for dictionary value @ data['trigger'][0]['state']. Got None (See /home/hass/.homeassistant/configuration.yaml:92)

I searched for this and read in other topics that I need single quotes on the states. Here is my corrected, working configuration:

shell_command:
 play_sound: sudo /usr/bin/omxplayer /usr/share/scratch/Media/Sounds/Instruments/Trumpet2.wav
automation:
  alias: 'Play Audio File'
  trigger:
    platform: state
    entity_id: binary_sensor.aeotec_dsb29_doorwindow_sensor_2nd_edition_sensor_3
    state: 'on'
  action:
    service: shell_command.play_sound

SOLVED! Thanks everybody :smiley:

3 Likes