diff --git a/src/emsdevice.cpp b/src/emsdevice.cpp index c7352134e..a7711a36b 100644 --- a/src/emsdevice.cpp +++ b/src/emsdevice.cpp @@ -43,8 +43,8 @@ bool EMSdevice::has_entities() const { return false; } -std::string EMSdevice::tag_to_string(uint8_t tag) { - return (Helpers::translated_word(DeviceValue::DeviceValueTAG_s[tag])); +std::string EMSdevice::tag_to_string(uint8_t tag, const bool translate) { + return (translate ? Helpers::translated_word(DeviceValue::DeviceValueTAG_s[tag]) : DeviceValue::DeviceValueTAG_s[tag][0]); } std::string EMSdevice::tag_to_mqtt(uint8_t tag) { diff --git a/src/emsdevice.h b/src/emsdevice.h index 6a582e982..9268d8aa2 100644 --- a/src/emsdevice.h +++ b/src/emsdevice.h @@ -49,7 +49,7 @@ class EMSdevice { static const char * device_type_2_device_name(const uint8_t device_type); static uint8_t device_name_2_device_type(const char * topic); static std::string uom_to_string(uint8_t uom); - static std::string tag_to_string(uint8_t tag); + static std::string tag_to_string(uint8_t tag, const bool translate = true); static std::string tag_to_mqtt(uint8_t tag); bool has_tag(const uint8_t tag) const; diff --git a/src/mqtt.cpp b/src/mqtt.cpp index 91ed56e6f..5d189006d 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -1091,7 +1091,7 @@ void Mqtt::publish_ha_sensor_config(uint8_t type, // EMSdevice // keep it compatible to v3.4, use english fullname, no prefix (basename prefix commented out) char object_id[130]; if (have_tag) { - snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_mqtt(tag).c_str(), en_name); + snprintf(object_id, sizeof(object_id), "%s_%s_%s", device_name, EMSdevice::tag_to_string(tag, false).c_str(), en_name); } else { snprintf(object_id, sizeof(object_id), "%s_%s", device_name, en_name); }