diff --git a/Config.h b/Config.h index cb36d31..c8f1bf4 100644 --- a/Config.h +++ b/Config.h @@ -4,6 +4,7 @@ #define GITHUB_LATEST_RELEASE_URL "https://github.com/technyon/nuki_hub/releases/latest" #define GITHUB_LATEST_RELEASE_API_URL "https://api.github.com/repos/technyon/nuki_hub/releases/latest" +#define GITHUB_LATEST_RELEASE_BINARY_URL "https://github.com/technyon/nuki_hub/raw/master/webflash/nuki_hub.bin" #define MQTT_QOS_LEVEL 1 #define MQTT_CLEAN_SESSIONS false diff --git a/Network.cpp b/Network.cpp index 48b823f..ba688af 100644 --- a/Network.cpp +++ b/Network.cpp @@ -375,7 +375,6 @@ bool Network::update() if (!jsonError) { _latestVersion = doc["tag_name"]; - _latestVersionUrl = doc["assets"][0]["browser_download_url"]; publishString(_maintenancePathPrefix, mqtt_topic_info_nuki_hub_latest, _latestVersion); } } @@ -675,11 +674,6 @@ const char* Network::latestHubVersion() return _latestVersion; } -const char* Network::latestHubVersionUrl() -{ - return _latestVersionUrl; -} - bool Network::encryptionSupported() { return _device->supportsEncryption(); diff --git a/Network.h b/Network.h index c2d6e00..009511c 100644 --- a/Network.h +++ b/Network.h @@ -64,7 +64,6 @@ public: int mqttConnectionState(); // 0 = not connected; 1 = connected; 2 = connected and mqtt processed const char* latestHubVersion(); - const char* latestHubVersionUrl(); bool encryptionSupported(); const String networkDeviceName() const; @@ -115,7 +114,6 @@ private: String _lockPath; const char* _latestVersion; - const char* _latestVersionUrl; HTTPClient https; Preferences* _preferences; diff --git a/WebCfgServer.cpp b/WebCfgServer.cpp index 3028246..daacb29 100644 --- a/WebCfgServer.cpp +++ b/WebCfgServer.cpp @@ -356,7 +356,7 @@ bool WebCfgServer::processArgs(String& message) { _preferences->putString(preference_mqtt_hass_cu_url, value); configChanged = true; - } + } else if(key == "HOSTNAME") { _preferences->putString(preference_hostname, value); @@ -622,16 +622,16 @@ void WebCfgServer::buildHtml(String& response) printParameter(response, "Nuki Opener state", lockstateArr); } printParameter(response, "Firmware", version.c_str(), "/info"); - + const char* _latestVersion = _network->latestHubVersion(); - + if(_preferences->getBool(preference_check_updates)) { //if(atof(_latestVersion) > atof(NUKI_HUB_VERSION) || (atof(_latestVersion) == atof(NUKI_HUB_VERSION) && _latestVersion != NUKI_HUB_VERSION)) { - printParameter(response, "Latest Firmware", _latestVersion, GITHUB_LATEST_RELEASE_URL); + printParameter(response, "Latest Firmware", _latestVersion, "/ota"); //} } - + response.concat("

"); response.concat("

MQTT and Network Configuration

"); @@ -741,6 +741,18 @@ void WebCfgServer::buildOtaHtml(String &response, bool errored) response.concat("
Choose the updated nuki_hub.bin file to upload:
"); response.concat("
"); + + if(_preferences->getBool(preference_check_updates)) + { + response.concat(""); + + response.concat("

"); + } + response.concat("
Initiating Over-the-air update. This will take about two minutes, please be patient.
You will be forwarded automatically when the update is complete.
"); response.concat("