Public Folders - A addon to serve static files over HTTP

Home assistant is brilliant, I love it.

How ever, after trying to stream media to my Door Bell I found that home assistant was unable to achieve this. The reason being is that my Door Bells media function does not support casting media files from an authenticated server. After asking several times on Discord about how I could resolve this issue and host the files on HA with out the need for authentication I came up blank. Luckily I found out that HA addons (or w/e we call them) are actually very easy to write, maintain and publish. I personally would like to pat who ever designed this system on the back, for a job well done.

So I would like to present to you my first ever HA addon (or w/e we call them) Public Folders. This is an extremely basic Node JS HTTP web server and really is nothing special and I have included no bells or whistles. How ever if my requirements change or somebody has a genius idea that might change.

You can find this addon over on my GitHub and you can add the GitHub repo to HA if you wish to install it.
Rusketh/HAPublicFolders

By default files under the HA media directory will be served on HTTP port 8080.
http://<HA-IP>:<port>/<handle>/<filepath>

e.g: http://<HA-IP>:8080/media/doorbell/ringtone.mp3

You can change the port and add/remove public directories via the config folder.
Under Config/Options you will find a list called folders, keep in mind Public Folders can only serve files that exist with in the media directory.

folders:
  - media:/media

Where media is the handle and /media is the directory. The handle acts like a folder name with in the URL. I suck at explaining things so here is an example.

If I wanted to create a URL to host my doorbell files I could use the following folder configuration:

folders:
  - door:/media/doorbell

I could then access my ringtone.mp3 from
http://<HA-IP>:8080/door/ringtone.mp3

I hope this is useful to somebody else and I hope to maybe contribute more node JS based (addons?) in the future. If the need should arise.

Thank you very much for this add-on! It took me a while to get syntax correct for my folder, and the associated URL, but it works perfectly!

Thanks again for making it, and releasing it to the Home Assistant community.