mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-23 18:56:38 +00:00
Add command `WebGetConfig <url>
`
Add command ``WebGetConfig <url>`` if ``#define USE_WEBGETCONFIG`` is enabled to restore/init configuration from external webserver (#13034)
This commit is contained in:
parent
4e835a63da
commit
1c4bca8a8c
@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
|
|||||||
## [Unreleased] - Development
|
## [Unreleased] - Development
|
||||||
|
|
||||||
## [9.5.0.8]
|
## [9.5.0.8]
|
||||||
|
### Added
|
||||||
|
- Command ``WebGetConfig <url>`` if ``#define USE_WEBGETCONFIG`` is enabled to restore/init configuration from external webserver (#13034)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- ESP32 crash when PSRAM is absent and ``BOARD_HAS_PSRAM`` set (#13037)
|
- ESP32 crash when PSRAM is absent and ``BOARD_HAS_PSRAM`` set (#13037)
|
||||||
- MQTT TLS related connection timing errors (#13033)
|
- MQTT TLS related connection timing errors (#13033)
|
||||||
|
@ -105,6 +105,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
|
|||||||
- Command ``SetOption127 1`` to force Wi-Fi in no-sleep mode even if ``Sleep 0`` is not enabled
|
- Command ``SetOption127 1`` to force Wi-Fi in no-sleep mode even if ``Sleep 0`` is not enabled
|
||||||
- Command ``SetOption128 0|1`` web referer check disabling HTTP API commands if set to 0. Default set to 1 for backward compatibility [#12828](https://github.com/arendst/Tasmota/issues/12828)
|
- Command ``SetOption128 0|1`` web referer check disabling HTTP API commands if set to 0. Default set to 1 for backward compatibility [#12828](https://github.com/arendst/Tasmota/issues/12828)
|
||||||
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver
|
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver
|
||||||
|
- Command ``WebGetConfig <url>`` if ``#define USE_WEBGETCONFIG`` is enabled to restore/init configuration from external webserver [#13034](https://github.com/arendst/Tasmota/issues/13034)
|
||||||
- Neopool commands ``NPPHRes``, ``NPCLRes`` and ``NPIonRes`` [#12813](https://github.com/arendst/Tasmota/issues/12813)
|
- Neopool commands ``NPPHRes``, ``NPCLRes`` and ``NPIonRes`` [#12813](https://github.com/arendst/Tasmota/issues/12813)
|
||||||
- Support for second DNS server
|
- Support for second DNS server
|
||||||
- Support for (Yeelight) Mi Desk Pro using binary tasmota32solo1.bin
|
- Support for (Yeelight) Mi Desk Pro using binary tasmota32solo1.bin
|
||||||
|
@ -461,6 +461,7 @@
|
|||||||
// #define USE_JAVASCRIPT_ES6 // Enable ECMAScript6 syntax using less JavaScript code bytes (fails on IE11)
|
// #define USE_JAVASCRIPT_ES6 // Enable ECMAScript6 syntax using less JavaScript code bytes (fails on IE11)
|
||||||
#define USE_ENHANCED_GUI_WIFI_SCAN // Enable Wi-Fi scan output with BSSID (+0k5 code)
|
#define USE_ENHANCED_GUI_WIFI_SCAN // Enable Wi-Fi scan output with BSSID (+0k5 code)
|
||||||
// #define USE_WEBSEND_RESPONSE // Enable command WebSend response message (+1k code)
|
// #define USE_WEBSEND_RESPONSE // Enable command WebSend response message (+1k code)
|
||||||
|
// #define USE_WEBGETCONFIG // Enable restoring config from external webserver (+0k6)
|
||||||
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
||||||
#define USE_EMULATION_WEMO // Enable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
#define USE_EMULATION_WEMO // Enable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
||||||
// #define USE_CCLOADER // Enable CCLoader FW upgrade tool (for CC25xx devices)
|
// #define USE_CCLOADER // Enable CCLoader FW upgrade tool (for CC25xx devices)
|
||||||
|
@ -3124,7 +3124,7 @@ int WebGetConfig(char *buffer)
|
|||||||
RemoveSpace(buffer); // host = |[192.168.178.86:80,admin:joker|
|
RemoveSpace(buffer); // host = |[192.168.178.86:80,admin:joker|
|
||||||
String url = ResolveToken(buffer);
|
String url = ResolveToken(buffer);
|
||||||
|
|
||||||
DEBUG_CORE_LOG(PSTR("WEB: Config Uri |%s|"), url.c_str());
|
DEBUG_CORE_LOG(PSTR("WEB: Config Uri '%s'"), url.c_str());
|
||||||
|
|
||||||
WiFiClient http_client;
|
WiFiClient http_client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
@ -3137,7 +3137,7 @@ int WebGetConfig(char *buffer)
|
|||||||
int len = http.getSize();
|
int len = http.getSize();
|
||||||
if ((len <= sizeof(TSettings)) && SettingsBufferAlloc()) {
|
if ((len <= sizeof(TSettings)) && SettingsBufferAlloc()) {
|
||||||
uint8_t *buff = settings_buffer;
|
uint8_t *buff = settings_buffer;
|
||||||
if (len==-1) len = sizeof(TSettings);
|
if (len == -1) { len = sizeof(TSettings); }
|
||||||
while (http.connected() && (len > 0)) {
|
while (http.connected() && (len > 0)) {
|
||||||
size_t size = stream->available();
|
size_t size = stream->available();
|
||||||
if (size) {
|
if (size) {
|
||||||
@ -3177,7 +3177,6 @@ int WebGetConfig(char *buffer)
|
|||||||
}
|
}
|
||||||
#endif // USE_WEBGETCONFIG
|
#endif // USE_WEBGETCONFIG
|
||||||
|
|
||||||
|
|
||||||
bool JsonWebColor(const char* dataBuf)
|
bool JsonWebColor(const char* dataBuf)
|
||||||
{
|
{
|
||||||
// Default (Dark theme)
|
// Default (Dark theme)
|
||||||
@ -3337,6 +3336,8 @@ void CmndWebSend(void)
|
|||||||
#ifdef USE_WEBGETCONFIG
|
#ifdef USE_WEBGETCONFIG
|
||||||
void CmndWebGetConfig(void)
|
void CmndWebGetConfig(void)
|
||||||
{
|
{
|
||||||
|
// WebGetConfig http://myserver:8000/tasmota/conf/%id%.dmp where %id% is expanded to device mac address
|
||||||
|
// WebGetConfig http://myserver:8000/tasmota/conf/Config_demo_9.5.0.8.dmp
|
||||||
if (XdrvMailbox.data_len > 0) {
|
if (XdrvMailbox.data_len > 0) {
|
||||||
uint32_t result = WebGetConfig(XdrvMailbox.data);
|
uint32_t result = WebGetConfig(XdrvMailbox.data);
|
||||||
char stemp1[20];
|
char stemp1[20];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user