Skip to content

Commit fc74ea3

Browse files
authoredDec 15, 2022
Pgollor patch 1 (#1128)
* add HTTP deploy information * add link for HTTP upload
1 parent da32d6e commit fc74ea3

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed
 

‎docs/Upgrading.md

+2
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ You can set up OTA url and initiate OTA upgrade from TDM using GUI.
129129

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

132+
[**Deploy via HTTP**](Visual-Studio-Code#deploy-via-http-upload) - deploy _.bin_ and _.bin.gz_ files to your own web server via PlatformIO upload
133+
132134
### Private OTA Server
133135
It is possible to create your own simple http OTA server (https is not supported) using Python and perform upgrades from there.
134136
Install Python3 and from the folder where the binary resides (make sure `tasmota-minimal.bin` is located there too) run:

‎docs/Visual-Studio-Code.md

+27-3
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,39 @@ upload_port = COM5
4242
upload_speed = 115200
4343
;upload_resetmethod = nodemcu
4444
```
45-
Special options (not needed for compiling Tasmota!) are enabled in _platformio_override.ini_ :
4645

46+
### deploy via HTTP upload
47+
48+
Special options (not needed for compiling Tasmota!) are enabled in _platformio_override.ini_ :
4749
```
4850
; *** Upload file to OTA server using HTTP
49-
upload_port = domus1:80/api/upload-arduino.php
50-
extra_scripts = pio/http-uploader.py
51+
upload_port = -i domus1 -p 80 -u /api/upload-arduino.php
52+
extra_scripts = ${esp_defaults.extra_scripts} pio/http-uploader.py
53+
```
54+
For ESP32 replace `esp_defaults` with `esp32_defaults`.
55+
56+
Or if you wish to upload the gzip files (not for ESP32 only for ESP8266):
57+
```
58+
upload_port = -i domus1 -p 80 -u /api/upload-arduino.php
59+
extra_scripts = ${esp_defaults.extra_scripts} pio/http-gz-uploader.py
5160
```
5261
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).
5362

63+
The _upload.php_ file at your webserver could look like this:
64+
```
65+
<?php
66+
$image = basename($_FILES["file"]["name"]);
67+
$target_file = "./".$image;
68+
$hostname = $_SERVER['SERVER_NAME'];
69+
70+
if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file)) {
71+
echo "The file $image has been uploaded to OTA server $hostname. \n";
72+
} else {
73+
echo "Sorry, there was an error uploading your file $image to OTA server $hostname. \n";
74+
}
75+
?>
76+
```
77+
5478
## *Hint:*
5579
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"
5680

0 commit comments

Comments
 (0)
Please sign in to comment.