SeanPM5 / homeassistant-config

14 stars 0 forks source link

Random classic game tune when launching Retropie Harmony activity #36

Open SeanPM5 opened 5 years ago

SeanPM5 commented 5 years ago

TV in the living room takes like 20 seconds to turn on, so it'd be kinda neat to play a short random classic game tune when launching the Retropie Harmony activity. Sonic Green Hill Zone, Mario theme, Tetris theme, things like that.

Automation would look for state of switch.retropie goes to 'on' and then call the media_player.play_media service on my Google Home Hub. Something like this:

      - service: media_player.play_media
        entity_id: media_player.living_room_display
        data_template:
          media_content_id: '{{ [ 
          "file1.mp3",
          "file2.mp3",
          "file3.mp3",
          ] |random }}'
          media_content_type: "audio/mp3"

edit: better version thanks to Ludeeus

  # Gives filename of random file from directory
  - platform: command_line
    name: Random VG Tune
    command: "find /config/www/retropie/ -type f | shuf -n 1"

Checklist: