Media_player with sound file as notify service?

Hi there,

i am trying to send a notification via alert integration when my windows are open too long. Sending a notification to the Android Companion App is easy, but how can I integrate a media_player as a notify service that just plays a sound file (no tts)?

Part of my automation for the same pourpose

action:
  - service: notify.mobile_app_in2013
    data:
      message: >-
        Hallo, een van de ramen staat open. Buiten is het minder, dan tien
        graden. Ik heb de verwarming uitgeschakeld. Ik zet het pas weer aan, als
        het raam weer dicht is.
  - service: notify.mobile_app_mischa_op6t
    data:
      message: >-
        Hallo, een van de ramen staat open. Buiten is het minder, dan tien
        graden. Ik heb de verwarming uitgeschakeld. Ik zet het pas weer aan, als
        het raam weer dicht is.
  - service: media_player.play_media
    target:
      entity_id: media_player.vlc_telnet
    data:
      media_content_id: http://192.XXX.XXX.XX:8123/local/ns-ding-dong.mp3
      media_content_type: music

The mp3 file has to be in your config/www/ directory

You can put a mp3 file in your config/www folder and have it played using service: media_player.play_media

See Trouble accessing local file over http and SONOS doorbell sound trough local mp3 file. Script + automation done but still not working if you need some inspiration.

I know how to play a soundfile with the media_player, that is not the question here.

The question here is how to play a soundfile via a notify.

Why specifically using notify? What’s the use case that demands a notify rather than play.media?

Please see my initial posting: The “alert” integration only supports notify.

OK, sorry my bad - maybe the correct question should have been, why if limited by the alert integration, not maybe use a standard automation with a repeat to achieve the same thing but without the limitations?

Where is the media file? On the ha server or on the android device?

And does this help? Introduction | Home Assistant Companion Docs

On the HA server.

You haven’t answered my second question :slight_smile:

This is not about the android companion app.

I think I must have read your first post incorrectly.

Trying again, you could use a command line notification and trigger your media player via the api.

Thanks. Crazy idea, but could work :slight_smile: However, I have now created my own alert via automation.

I do feel that the “alert” integration has been kind of left behind. There is no frontend editor for it and, as you’ve pointed out, the limitations on what it can “notify” are pretty strict.

I’d like to see “alert” merged into automation as a trigger type, I think that would be the best of both worlds. The example of a open garage door that exists on the page is prime. I use android tablets in the house as “announcers” for things but with the “alert” I cannot specify a command other than a “notify” so I cannot use “alert” to send the mqtt packet to have the tablet say “Hey, the garage door has been open for over an hour!”

Yes, you are absolutely right. And I like your idea with the trigger for an automation… Hopefully someone will pick that up.

Not unless you put in a feature request.