Home Assistant as file server over HTTP for TasmOTA images [SOLVED]

Hi,

Is it possible to configure/use hass as HTTP file server?
To enable OTA with TasmOTA the server to be set in user_config.h:

#define OTA_URL                "http://IP:PORT/api/arduino/" PROJECT ".ino.bin"  // [OtaUrl]

Once hass is running HTTP already and it has api, I wanted to “ride” on this feature and avoid configuring another HTTP server on the same machine.

Currenltly, the api works OK with following config:

http:
api:

…and I get good response by this guide:

I wonder how to configure it to serve binary files?
Where to put them?
What’s the base folder of hass server?

Thank you.

try this

Thank you, Rob.

Summary for others:
Serving files over HTTP with Home Assistant.
Tested with homeassistant 0.62.1.

  1. Either under hass.io or under Home Assistant, understand your config folder. It can be:
    /home/homeassistant/.homeassistant - if you’re running HA in virtualenv
    or
    /home/<your_user>/.homeassistant - if you’re running HA without virtualenv (example: /home/pi/.homeassistant)

  2. cd <your_config_dir>; mkdir www
    Here is the trick: the files in www folder will be accessible as in ‘local/’ folder.

  3. Put some files there. For example:
    cd www; echo test > test.txt

  4. Restart the HA or hass.io.

  5. Find your file @ address: http:/<ha_ip>:8123/local/test.txt
    For TasmOTA images don’t forget to edit the user_config.h with:

     #define OTA_URL    "http://IP:8123/local/" PROJECT ".ino.bin?api_password=<your_api_pwd>"  // [OtaUrl]
    

Notice: (as mentioned in many recommendations): define and enable the api_password in configuration.yaml :wink: