mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
rollback and fix https://github.com/emsesp/EMS-ESP32/pull/1426
This commit is contained in:
@@ -827,7 +827,7 @@ std::string EMSdevice::get_value_uom(const std::string & shortname) const {
|
|||||||
return std::string{}; // not found
|
return std::string{}; // not found
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EMSdevice::export_values(uint8_t unique_id, JsonObject & output, const int8_t id, const uint8_t output_target) {
|
bool EMSdevice::export_values(uint8_t device_type, JsonObject & output, const int8_t id, const uint8_t output_target) {
|
||||||
bool has_value = false;
|
bool has_value = false;
|
||||||
uint8_t tag;
|
uint8_t tag;
|
||||||
if (id >= 1 && id <= (1 + DeviceValueTAG::TAG_HS16 - DeviceValueTAG::TAG_HC1)) {
|
if (id >= 1 && id <= (1 + DeviceValueTAG::TAG_HS16 - DeviceValueTAG::TAG_HC1)) {
|
||||||
@@ -840,7 +840,7 @@ bool EMSdevice::export_values(uint8_t unique_id, JsonObject & output, const int8
|
|||||||
|
|
||||||
if (id > 0 || output_target == EMSdevice::OUTPUT_TARGET::API_VERBOSE) {
|
if (id > 0 || output_target == EMSdevice::OUTPUT_TARGET::API_VERBOSE) {
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice->unique_id() == unique_id) {
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
has_value |= emsdevice->generate_values(output, tag, (id < 1), output_target); // use nested for id -1 and 0
|
has_value |= emsdevice->generate_values(output, tag, (id < 1), output_target); // use nested for id -1 and 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -852,7 +852,7 @@ bool EMSdevice::export_values(uint8_t unique_id, JsonObject & output, const int8
|
|||||||
JsonObject output_hc = output;
|
JsonObject output_hc = output;
|
||||||
bool nest_created = false;
|
bool nest_created = false;
|
||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
if (emsdevice->unique_id() == unique_id) {
|
if (emsdevice && (emsdevice->device_type() == device_type)) {
|
||||||
if (!nest_created && emsdevice->has_tags(tag)) {
|
if (!nest_created && emsdevice->has_tags(tag)) {
|
||||||
output_hc = output.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
output_hc = output.createNestedObject(EMSdevice::tag_to_mqtt(tag));
|
||||||
nest_created = true;
|
nest_created = true;
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ bool System::command_allvalues(const char * value, const int8_t id, JsonObject &
|
|||||||
for (const auto & emsdevice : EMSESP::emsdevices) {
|
for (const auto & emsdevice : EMSESP::emsdevices) {
|
||||||
std::string title = emsdevice->device_type_2_device_name_translated() + std::string(" ") + emsdevice->to_string();
|
std::string title = emsdevice->device_type_2_device_name_translated() + std::string(" ") + emsdevice->to_string();
|
||||||
device_output = output.createNestedObject(title);
|
device_output = output.createNestedObject(title);
|
||||||
emsesp::EMSdevice::export_values(emsdevice->unique_id(), device_output, id, EMSdevice::OUTPUT_TARGET::API_VERBOSE);
|
emsdevice->generate_values(device_output, DeviceValueTAG::TAG_NONE, true, EMSdevice::OUTPUT_TARGET::API_VERBOSE); // use nested for id -1 and 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom entities
|
// Custom entities
|
||||||
|
|||||||
Reference in New Issue
Block a user