Skip to content

Commit

Permalink
Pgollor patch 1 (tasmota#1128)
Browse files Browse the repository at this point in the history
* add HTTP deploy information

* add link for HTTP upload
  • Loading branch information
pgollor authored Dec 15, 2022
1 parent da32d6e commit fc74ea3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/Upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ You can set up OTA url and initiate OTA upgrade from TDM using GUI.

[**OTA over SCP**](OTA-over-SCP) - setup and configure "OTA over SCP" upload for PlatformIO

[**Deploy via HTTP**](Visual-Studio-Code#deploy-via-http-upload) - deploy _.bin_ and _.bin.gz_ files to your own web server via PlatformIO upload

### Private OTA Server
It is possible to create your own simple http OTA server (https is not supported) using Python and perform upgrades from there.
Install Python3 and from the folder where the binary resides (make sure `tasmota-minimal.bin` is located there too) run:
Expand Down
30 changes: 27 additions & 3 deletions docs/Visual-Studio-Code.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,39 @@ upload_port = COM5
upload_speed = 115200
;upload_resetmethod = nodemcu
```
Special options (not needed for compiling Tasmota!) are enabled in _platformio_override.ini_ :

### deploy via HTTP upload

Special options (not needed for compiling Tasmota!) are enabled in _platformio_override.ini_ :
```
; *** Upload file to OTA server using HTTP
upload_port = domus1:80/api/upload-arduino.php
extra_scripts = pio/http-uploader.py
upload_port = -i domus1 -p 80 -u /api/upload-arduino.php
extra_scripts = ${esp_defaults.extra_scripts} pio/http-uploader.py
```
For ESP32 replace `esp_defaults` with `esp32_defaults`.

Or if you wish to upload the gzip files (not for ESP32 only for ESP8266):
```
upload_port = -i domus1 -p 80 -u /api/upload-arduino.php
extra_scripts = ${esp_defaults.extra_scripts} pio/http-gz-uploader.py
```
Easy compilation and upload can be performed from the icons at the bottom of the VSC screen or use `Ctrl` + `Alt` + `U` to upload (will build if needed).

The _upload.php_ file at your webserver could look like this:
```
<?php
$image = basename($_FILES["file"]["name"]);
$target_file = "./".$image;
$hostname = $_SERVER['SERVER_NAME'];
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
echo "The file $image has been uploaded to OTA server $hostname. \n";
} else {
echo "Sorry, there was an error uploading your file $image to OTA server $hostname. \n";
}
?>
```

## *Hint:*
In case vscode shows a huge amount of errors using PlatformIO - Intellisense a possible "solution" is to change the cpp-Intelli Sense Engine type to "TAG PARSER"

Expand Down

0 comments on commit fc74ea3

Please sign in to comment.