mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
incorporated Michael's changes https://github.com/emsesp/EMS-ESP32/pull/2027
This commit is contained in:
@@ -298,8 +298,9 @@ bool Command::set_attribute(JsonObject output, const char * cmd, const char * at
|
|||||||
if (attribute == nullptr) {
|
if (attribute == nullptr) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (output[attribute].is<std::string>()) {
|
|
||||||
std::string data = output[attribute];
|
if (output[attribute].is<JsonVariantConst>()) {
|
||||||
|
std::string data = output[attribute].as<std::string>();
|
||||||
output.clear();
|
output.clear();
|
||||||
output["api_data"] = data; // always as a string
|
output["api_data"] = data; // always as a string
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
|
|||||||
|
|
||||||
if (return_code == CommandRet::OK) {
|
if (return_code == CommandRet::OK) {
|
||||||
if (json.size()) {
|
if (json.size()) {
|
||||||
if (json["api_data"].is<String>()) {
|
if (json["api_data"].is<std::string>()) {
|
||||||
String data = json["api_data"];
|
String data = json["api_data"];
|
||||||
shell.println(data.c_str());
|
shell.println(data.c_str());
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ void WebSchedulerService::publish(const bool force) {
|
|||||||
JsonDocument doc;
|
JsonDocument doc;
|
||||||
bool ha_created = ha_registered_;
|
bool ha_created = ha_registered_;
|
||||||
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
|
for (const ScheduleItem & scheduleItem : *scheduleItems_) {
|
||||||
if (!scheduleItem.name.empty() && !doc[scheduleItem.name].is<const char *>()) {
|
if (!scheduleItem.name.empty() && !doc[scheduleItem.name].is<JsonVariantConst>()) {
|
||||||
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
|
if (EMSESP::system_.bool_format() == BOOL_FORMAT_TRUEFALSE) {
|
||||||
doc[scheduleItem.name] = scheduleItem.active;
|
doc[scheduleItem.name] = scheduleItem.active;
|
||||||
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
} else if (EMSESP::system_.bool_format() == BOOL_FORMAT_10) {
|
||||||
|
|||||||
Reference in New Issue
Block a user