"no entries" is valid command execution

This commit is contained in:
MichaelDvP
2023-09-19 14:22:38 +02:00
parent 42a4c792ad
commit 8b136ddefe
4 changed files with 7 additions and 8 deletions

View File

@@ -626,7 +626,7 @@ void AnalogSensor::publish_values(const bool force) {
bool AnalogSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) const {
if (sensors_.empty()) {
output["message"] = "no entries";
return false;
return true;
}
// make a copy of the string command for parsing
char command_s[30];

View File

@@ -927,12 +927,9 @@ bool EMSESP::process_telegram(std::shared_ptr<const Telegram> telegram) {
if (telegram->type_id == publish_id_) {
publish_id_ = 0;
}
// dont publish if not connected and don't reset flag, so publish is done after reconnect
if (Mqtt::connected()) {
emsdevice->has_update(false); // reset flag
if (!Mqtt::publish_single()) {
publish_device_values(emsdevice->device_type()); // publish to MQTT if we explicitly have too
}
emsdevice->has_update(false); // reset flag
if (!Mqtt::publish_single()) {
publish_device_values(emsdevice->device_type()); // publish to MQTT if we explicitly have too
}
}
}

View File

@@ -391,7 +391,7 @@ bool TemperatureSensor::command_info(const char * value, const int8_t id, JsonOb
bool TemperatureSensor::get_value_info(JsonObject & output, const char * cmd, const int8_t id) {
if (sensors_.empty()) {
output["message"] = "no entries";
return false;
return true;
}
// make a copy of the string command for parsing
char command_s[30];

View File

@@ -269,11 +269,13 @@ bool WebEntityService::get_value_info(JsonObject & output, const char * cmd) {
JsonVariant data = output[attribute_s];
output.clear();
output["api_data"] = data;
return true;
} else {
char error[100];
snprintf(error, sizeof(error), "cannot find attribute %s in entity %s", attribute_s, command_s);
output.clear();
output["message"] = error;
return false;
}
}
}