Home Assistant offers a built-in, very simple way to host files on its own HTTP server. This can be very useful when we want to perform OTA (remote firmware update) on some device that expects to give it a URL with a file and only supports HTTP. An example of such a situation may be Tasmota (when we want to upload our own build) or Sonoff NSPanel (the FlashNextion command to change the display firmware also requires the file URL).
The situation is complicated by the fact that often newer hosting solutions available on the web force HTTPS, which makes it impossible, for example, to download this Nextion via ordinary HTTP. For the same reason, for example, it is not possible to download binaries directly from Github.
You can easily set up an HTTP server at your place, for example using Visual Code, or Node.JS, or other Python tools, but why? Just use HA...
Here I will briefly show how this can be done.
HTTP hosting in HA I wrote quite a lot about HA itself in this topic:
Tutorial Home Assistant - configuration, WiFi, MQTT, Zigbee, Tasmota Some convenient access to it will be useful, I mapped the config folder via SMB:
This allows you to conveniently operate on the Assistant's files:
We upload the files we want to host to config/www :
For me, there are ripples for the Sonoff panel, which I will describe soon.
You can get to them from a web address like:
The subdirectory is very important local We can't get to them without him!
Just opening this URL will download the file - without logging in:
And it is this URL that can be given to devices that need to download our update via HTTP GET...
Summary I have the impression that few people know about this option, and it is most useful. It is worth knowing about it, the more that no one will guess that these files are available in the subdirectory local and as we know, users often skip reading the documentation...
It turns out that hosting files on HA itself is very simple - just right for OTA.
PS: Of course, remember that if our HA is only in the local network, these files will only be visible in the local network. But we rather know that, don't we? Same as other servers.