How to fix the '401' on the media folder

I am trying to send an MP3 to ‘an external system’ (not to overcomplicate the question). However i get an alert in my log that there was an illegal login attempt and the file gives a 401.

The file is located in my /media/ folder; and is perfectly playable via the web interface of HA. Therefore i think the /media/ folder is somehow protected by the HA UI.

I did add the /media entry to the configuration.yaml like this:

    - /media

But that doesn’t seem to resolve/help. What am i missing?

Hi there…To which external system, are to sending the file and how?

Hi @sheminasalam that doesn’t really matter if i also can’t open the file without authorisation in the browser (not on the external URL and not on the internal, by IP, URL for that matter).

Got it:

  - service: media_player.play_media
    entity_id: group.doorbell
      media_content_type: music
      media_content_id: media-source://media_source/local/doorbell.mp3

(as per documentation:

You, sir, are a lifesaver. This was driving me insane! Adding some random keywords to this post to help people find it based on the errors I got and what I searched for:

401: unauthorized
1 Like

I’m sorry but this is driving me up the wall.

I have defined the the following media dirs in my config file:

    music: /media/music
    sounds: /media/sounds
    books: /media/books
    images: /media/images
    icons: /media/icons

and I’m trying to link to an svg file stored in the “icons” directory. Like this:

- service: media_player.play_media
          entity_id: media_player.nest_living_room
          media_content_type: music
          media_content_id: >
            {%- set station = states('input_select.radio_station') -%}
            {% if station == "BBC Radio 1" %}
            {% elif station == "BBC Radio 1 Dance" %}
            {% endif %}              
            thumb: >
              {%- set station = states('input_select.radio_station') -%}
              {% if 'BBC Radio 1' in station %} http://homeassistant.local:8123/media/icons/BBC-Radio-1-01.svg
              {% elif 'BBC Radio 1 Dance' in station %} http://homeassistant.local:8123/media/icons/BBC-Radio-1-01.svg
              {% endif %}                
            stream_type: LIVE
  1. the svg doesn’t show on the media player
  2. navigating to this link on the browser returns “401 unauthorized”
  3. media-source://media_source/icons/BBC-Radio-1-01.svg didn’t work either

what am I doing wrong?

Might be worth checking who “owns” those folders.