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

Been using Home Assistant for a little over a year and have been loving it!

I built a custom Baby Monitor similar to the one in the guide, but have been trying to find a way to pass on the audio from the monitor camera to the phone as the notification sound (or, alternatively played even if the phone screen is off in addition to the notification sound) so that we can instantly hear it without having to open the companion app, go to the correct lovelace page, click on more info for the camera, and press play to get the audio.

Things I’ve done so far:

° Setup camera as RTSP stream into Home Assistant

° Use ffmpeg and automations to send a notification to the companion app when noise is detected

° Set the notification to be priority and alarm stream so it goes to the phone fast and reliability

Things I’ve tried so far:

° Set custom notification sound for that channel on my phone since Android app does not support custom notification sounds on the Home Assistant side (phone allows mp3 or other media file, but I cannot find a way to point to an audio stream and not a singular file)

° Use the notification commands to turn on the screen (although it does not get past the lockscreen even if the phone is unlocked via Smart Lock but needs to be swiped to get to the home screen) and open the app to the lovelace page for the monitor

° Use Browser Mod to expand the More Info card for the camera (which sometimes auto-plays but does not other times, I have been unable to figure out the right conditions to make it auto-play every time and have been unable to find a setting to always auto-play)

° Use Browser Mod to make the companion app a media player (able to play mp3 files either locally or online using the media_player.play_media service, but cannot get it to play an audio stream and it only plays if the phone screen is on and the app is open in the foreground)

° Use Browser Mod media player from the camera:play_stream service (works on other audio-only media players like Google Home Mini but does not work for the Browser Mod media players)

° Use “command broadcast intent” in the notification to get it to play on VLC on the phone (also seems to only work if the screen is on and phone is unlocked and have been unable to figure out the right intents to get it to play a stream)

Any help at all would be greatly appreciated! Thanks!

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
1 Like

Is there a list of commands that someone can access to know what’s available?