mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
"no entries" is valid command execution
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user