Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make ota.enabled configuration optional
* OTA will be disabled by default if `ota.enabled` is not provided
  • Loading branch information
mkfrey committed Dec 19, 2019
commit 64ca0bad9d412d8a0e5bcab292d3f996f743eb78
20 changes: 11 additions & 9 deletions src/Homie/Utils/Validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,17 +345,19 @@ ConfigValidationResult Validation::_validateConfigOta(const JsonObject object) {

JsonVariant ota = object["ota"];

if (!ota.is<JsonObject>()) {
result.reason = F("ota is not an object");
return result;
}
if (!ota.isNull()) {
if (!ota.is<JsonObject>()) {
result.reason = F("ota is not an object");
return result;
}

{
JsonVariant otaEnabled = ota["enabled"];
{
JsonVariant otaEnabled = ota["enabled"];

if (!otaEnabled.is<bool>()) {
result.reason = F("ota.enabled is not a boolean");
return result;
if (!otaEnabled.isNull() && !otaEnabled.is<bool>()) {
result.reason = F("ota.enabled is not a boolean");
return result;
}
}
}

Expand Down