Audio stream as notification sound / play on phone while screen is off?

I got it to work! Thanks to /u/shakuyi on Reddit for their help as well as ChrisRosenkreuz23 on the discord!

In the end I used the code below to have it play the RTSP stream on VLC in the background in addition to a loud notification. I also have separate commands to set the media volume and then end playback when noise is no longer detected. NOTE: This plays the audio only in the background even if the phone is locked, just as I was looking for. If you need it to pull up a video on the screen this will only get you part of the way there.

    service: notify.mobile_app_<your phone>
    data:
      message: "command_activity"
      title: "rtsp://<your RTSP stream>"
      data:
        channel: "org.videolan.vlc"
        tag: "android.intent.action.VIEW"

Other helpful commands used in this project:

  1. Set Volume level for media playback (to make sure it is audible):
    service: notify.mobile_app_<your phone>
    data:
      message: "command_volume_level"
      title: 20
      data:
        channel: "music_stream"
  1. Stop playback and end VLC ongoing notification:
    service: notify.mobile_app_<your phone>
    data:
      message: "command_media"
      title: "stop"
      data:
        channel: "org.videolan.vlc"
  1. Turn on the screen so notifications are more likely to wake me up at night:
    service: notify.mobile_app_<your phone>
    data:
      message: "command_screen_on"
  1. General Notification with image from the camera which will take you to correct lovelace page in the app when selected (You can also use the custom channel to have a unique notification sound accompany the stream audio in your phone’s settings)
    service: notify.mobile_app_<your phone>
    data:
      message: Sound was detected in the Baby Room
      title: Baby Crying
      data:
        image: >-
          <your image uri as shown in Dev Tools for the camera under 'entity_picture'>
        ttl: 0
        priority: high
        channel: baby_monitor
        importance: max
        actions:
          - action: URI
            title: Open Monitor
            uri: /lovelace/baby
8 Likes