mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-06-13 19:36:26 +03:00
dont show unused json elements
This commit is contained in:
@@ -234,7 +234,7 @@ bool WebCustomEntityService::command_setvalue(const char * value, const int8_t i
|
||||
}
|
||||
|
||||
publish_single(entityItem);
|
||||
if (EMSESP::mqtt_.get_publish_onchange(0)) {
|
||||
if (EMSESP::mqtt_.get_publish_onchange(EMSdevice::DeviceType::SYSTEM)) {
|
||||
publish();
|
||||
}
|
||||
char cmd[COMMAND_MAX_LENGTH];
|
||||
@@ -415,13 +415,13 @@ std::string WebCustomEntityService::get_metrics_prometheus() {
|
||||
|
||||
// build the json for specific entity
|
||||
void WebCustomEntityService::get_value_json(JsonObject output, CustomEntityItem const & entity) {
|
||||
output["name"] = (const char *)entity.name;
|
||||
output["fullname"] = (const char *)entity.name;
|
||||
output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems";
|
||||
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
|
||||
output["readable"] = true;
|
||||
output["name"] = (const char *)entity.name;
|
||||
output["fullname"] = (const char *)entity.name;
|
||||
output["storage"] = entity.ram == 1 ? "ram" : entity.ram == 2 ? "nvs" : "ems";
|
||||
output["type"] = entity.value_type == DeviceValueType::BOOL ? "boolean" : entity.value_type == DeviceValueType::STRING ? "string" : F_(number);
|
||||
// output["readable"] = true;
|
||||
output["writeable"] = entity.writeable;
|
||||
output["visible"] = true;
|
||||
// output["visible"] = true;
|
||||
|
||||
if (entity.ram == 0) {
|
||||
output["device_id"] = Helpers::hextoa(entity.device_id);
|
||||
@@ -470,7 +470,7 @@ void WebCustomEntityService::publish(const bool force) {
|
||||
publish_single(entityItem);
|
||||
}
|
||||
return;
|
||||
} else if (!EMSESP::mqtt_.get_publish_onchange(0)) {
|
||||
} else if (!EMSESP::mqtt_.get_publish_onchange(EMSdevice::DeviceType::SYSTEM)) {
|
||||
return; // wait for first time period
|
||||
}
|
||||
}
|
||||
@@ -729,7 +729,7 @@ bool WebCustomEntityService::get_value(const std::shared_ptr<const Telegram> & t
|
||||
entity.data = data.c_str();
|
||||
if (Mqtt::publish_single()) {
|
||||
publish_single(entity);
|
||||
} else if (EMSESP::mqtt_.get_publish_onchange(0)) {
|
||||
} else if (EMSESP::mqtt_.get_publish_onchange(EMSdevice::DeviceType::SYSTEM)) {
|
||||
has_change = true;
|
||||
}
|
||||
char cmd[COMMAND_MAX_LENGTH];
|
||||
@@ -751,7 +751,7 @@ bool WebCustomEntityService::get_value(const std::shared_ptr<const Telegram> & t
|
||||
entity.value = value;
|
||||
if (Mqtt::publish_single()) {
|
||||
publish_single(entity);
|
||||
} else if (EMSESP::mqtt_.get_publish_onchange(0)) {
|
||||
} else if (EMSESP::mqtt_.get_publish_onchange(EMSdevice::DeviceType::SYSTEM)) {
|
||||
has_change = true;
|
||||
}
|
||||
char cmd[COMMAND_MAX_LENGTH];
|
||||
|
||||
Reference in New Issue
Block a user