Can't access www directory with hass.io

I’m using let’s encrypt/duckdns and I created a /config/www and added a file, dog.mp3. If everything is working, I should be able to point my browser to https://my-ip:8123/local/dog.mp3.

However, when I do this I simple get 404: not found. I’m also running Samba so I can see and execute the file via Windows on \hassio\config\www\dog.mp3.

What am I doing wrong?

I am also having problems with pictures. I haven’t tried the http method that you describe, but I am just looking for something that actually works at this point. Looking through the threads it seems that issues with the pictures are not uncommon.

I just tried to see if I could pull up the picture on my raspberry pi from a web browser (I’m at work right now) and it worked.

https://my_domain_name.duckdns.org/local/pic_name.jpg

I tried accessing dog from https://(my domain):8123/local/dog.mp3 and it doesn’t work either. However, HA works fine with https://(my domain):8123/

What now?

it could be a permissions problem. If you ssh into hassio, who owns the www directory? It should show up as root.

I experience the same behavior in HASS.IO. Other use-case, I am using custom icons/images for WebOS notifications.
The notifier service cannot access the /local/image.jpg (in the /config/www/ folder).

While accessing that same image.jpg on the same path in the browser works ok for me as well. Both internal ip and externally through TOR.

To recap: this works in the browser:
http://192.168.x.x:8123/local/image.jpg
or on my phone using TOR:
xxxxxxxxxx.onion:8123/local/image.jpg

I set the icon path in the configuration.yaml to that same path
icon: “/local/image.jpg”
It does not work and I see an error in the log that the service cannot find the file.

But it works ok when I copy the image.jpg to the /config/ folder (root of all config files) and change the icon path in the configuration.yaml to:
icon: “image.jpg”

Very strange behavior indeed. So it looks to me like a bug in HASS.IO and not related to how it is accessed. You rule that out by accessing it ok directly in the browser.

/EDIT:
I checked the permissions on the folder /www and the files it contains, the owner is root for all.

Try restarting HA after updating content in /config/www.

1 Like

I restarted HA and can now retrieve the file with my browser at https://(my domain):8123/local/dog.mp3

However, in my automation, I’m trying to play this audio file through my sonos:

  action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.family_room
      volume_level: 0.75
  - service: media_player.volume_set
    data:
      entity_id: media_player.dining_room
      volume_level: 0.75
  - delay: 0:30
  - service: media_player.play_media
    data:
      entity_id: media_player.family_room
      media_content_id: https://192.168.1.188:8123/local/dog.mp3
      media_content_type: music
  - service: media_player.play_media
    data:
      entity_id: media_player.dining_room
      media_content_id: https://192.168.1.188:8123/local/dog.mp3
      media_content_type: music

This worked successfully when I was running Raspbian. If I watch my Sonos app I can see HA communicating with Sonos, the volume changes, and dog.mp3 appears in the player on the app, but I get a message which says "Unable to play dog.mp3, connection to 192.168.1.188:8123 was lost. I’ve tried changing my internal IP address to the domain name but that doesn’t work either.

Can you use a sonos play list to accomplish this or point it to an smb share instead? You don’t need to share your audio content on the internet, your sonos just needs to get to it. So in this case HomeAssistant doesn’t need to host this content.

I tried…

  media_content_id: \\hassio\config\www\dog.mp3

but that doesn’t work either, even though I can access this via Windows.

This exact same thing is happening to me as well except with a Google Home Mini. And now, w/ 0.59.1 I can’t get TTS to even work on the GH.

Any solutions? I’ve tried adding www to the whitelist but still no success…

No, I gave up for the moment. There’s surely a developer out there who hasn’t come across this thread :slight_smile

So if you go through your Sonos app, can you play dog.mp3?

I changed my automation to:

action:
  - service: media_player.volume_set
    data:
      entity_id: media_player.family_room
      volume_level: 0.75
  - service: media_player.volume_set
    data:
      entity_id: media_player.dining_room
      volume_level: 0.75
  - delay: 0:30
  - service: media_player.play_media
    data:
      entity_id: media_player.family_room
      media_content_id: dog.mp3
      media_content_type: music
  - service: media_player.play_media
    data:
      entity_id: media_player.dining_room
      media_content_id: dog.mp3
      media_content_type: music

But I get the following errors:

Error on play_media with UPnP Error 714 received: Illegal MIME-Type from 192.168.1.151
4:43 PM components/media_player/sonos.py (ERROR)
UPnP Error 714 received: Illegal MIME-Type from 192.168.1.151
4:43 PM /usr/lib/python3.6/site-packages/soco/services.py (ERROR)
Error on play_media with UPnP Error 714 received: Illegal MIME-Type from 192.168.1.190
4:43 PM components/media_player/sonos.py (ERROR)
UPnP Error 714 received: Illegal MIME-Type from 192.168.1.190
4:43 PM /usr/lib/python3.6/site-packages/soco/services.py (ERROR)

I’m able to type play dog.mp3 via the Sonos app if I select my Music Directory and search for dog.mp3. Does the media_content_id need a path to the file?

Interesting. I have not used HA to initiate the play command, but I did put an file in //hassio/config/www. Then I added that folder as a music share in the Sonos app and was able to play it through the Sonos app.

Another possibility is to look at the snapshot/restore service in HA for the Sonos component.

don’t know much about sonos, but with bose soundtouch it is clearly said:

You can also play HTTP (not HTTPS) URLs

so I reckon that with encryption enabled this wouldn’t be possible. you can try to access via NAS or other network storage type (maybe HA cloud?)

Wondering if you can shed some light on this issue for me.

I’m simply trying to send a photo from my front door bell camera to my mobile. Sending a publicly available file is not an issue (pulled an image from the web) using developer tools>call service I receive the notification with the photo. However, I can take my own photo via the doorbell, I can store the doorbell.jpg photo in my www folder, I can open it and see its there, however I cannot open it from Chrome or any other web browser and thus I cannot send it included in any notification (apparently it must be public).

I’m running hassio via ubuntu on virtual box (windows configuration), however I’m not sure this is the issue at hand.

Any insight would be much appreciated.

Not sure who must own that folder in system but could that be the problem (file permissions)?

thanks. Still not sure why or how as hassio should operate the same regardless if its running in virtual box or not. I’ll keep trying.