diff --git a/Python-HTTP-OTA-Server.md b/Python-HTTP-OTA-Server.md index f9db172f..f7f20463 100644 --- a/Python-HTTP-OTA-Server.md +++ b/Python-HTTP-OTA-Server.md @@ -49,14 +49,14 @@ Example: ## Linux server: If your MQTT broker is hosted on a local server, you may want Tasmota OTA to work the same server as a service. Here is how to achieve this: -- Copy the python script on the Linux server +- Copy the python script on the Linux server: ``` $ sudo su # mkdir /srv/tasmota/fw_server/fw # cd /srv/tasmota/fw_server # wget https://github.com/arendst/Sonoff-Tasmota/tree/development/tools/fw_server/fw-server.py ``` -- Create a new file '/etc/systemd/system/tasmota.service' and copy those lines : +- Create a new file '/etc/systemd/system/tasmota.service' and copy those lines: ``` [Unit] Description=Local OTA server for Tasmota @@ -72,7 +72,8 @@ If your MQTT broker is hosted on a local server, you may want Tasmota OTA to wor [Install] WantedBy=multi-user.target ``` -- User rights +- User rights: + We have created those files and directories as `root` but it is not desirable, the option `User=XYZ` should be uncommented and `XYZ` replaced by you usernane. In the following commands too, replace 4 time `XYZ` by your username : @@ -80,22 +81,23 @@ If your MQTT broker is hosted on a local server, you may want Tasmota OTA to wor # chown -hR XYZ:XYZ /srv/tasmota # chown XYZ:XYZ /etc/systemd/system/tasmota.service ``` -- Run the service +- Run the service: ``` # systemctl daemon-reload # systemctl enable tasmota.service # systemctl start tasmota.service ``` -- Check the service is active and running. +- Check the service is active and running: ``` # systemctl status tasmota.service ``` -- Test of the server +- Test of the server: + To feed the Linux server, we're now able to copy new firmware files in the folder `/srv/tasmota/fw_server/fw` with `XYZ` user rights. It can be done using `scp` or `samba` for instance. Upload `firmware.bin` into the folder. The service can be tested from any browser by issuing the address `http://<ip_address>:5000/firmware.bin` were `<ip_address>` is the address of the Linux server. -If you reboot the server, the service should startup again. + If you reboot the server, the service should startup again. -- After a power failure, local HTTP OTA server may become unresponsive +- After a power failure, local HTTP OTA server may become unresponsive: If you notice that the OTA mechanism is broken, try at first to download the served file from a browser. If you can't, then check the status of the service as said above. After a power failure, your wlan0 IP may resolve to an invalid value like `169.254.5.153` because your LAN gateway was not ready. @@ -107,6 +109,7 @@ If you reboot the server, the service should startup again. ``` If you recognize the IP address of your server on the last status line, it should be OK now... OTA service restored! -- PlatformIO +- PlatformIO: + If you want PlatformIO to be able to upload your compiled binaries to the local server, you'll still have to setup `ssh` with `ssh-keygen` in order to use the Tasmota script `pio/sftp-uploader.py` without password.