Elektroda.com
Elektroda.com
X

Simple HTTP server/file hosting for Home Assistant (useful for OTA)

p.kaczmarek2 1737 0
This content has been translated flag-pl » flag-en View the original version here.
  • Simple HTTP server/file hosting for Home Assistant (useful for OTA)
    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:
    Simple HTTP server/file hosting for Home Assistant (useful for OTA)
    Simple HTTP server/file hosting for Home Assistant (useful for OTA)
    This allows you to conveniently operate on the Assistant's files:
    Simple HTTP server/file hosting for Home Assistant (useful for OTA)
    We upload the files we want to host to config/www :
    Simple HTTP server/file hosting for Home Assistant (useful for OTA)
    For me, there are ripples for the Sonoff panel, which I will describe soon.
    You can get to them from a web address like:
    
    http://192.168.0.113:8123/local/ns-panel.tft
    

    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:
    Simple HTTP server/file hosting for Home Assistant (useful for OTA)
    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.

    Cool? Ranking DIY
    About Author
    p.kaczmarek2
    Moderator Smart Home
    Offline 
    p.kaczmarek2 wrote 5826 posts with rating 5811, helped 278 times. Been with us since 2014 year.