pretty_telegram 2nd fallback for name

This commit is contained in:
MichaelDvP
2024-02-03 14:58:07 +01:00
parent 5bd9ec963f
commit 9573c4ed94

View File

@@ -742,10 +742,20 @@ std::string EMSESP::pretty_telegram(std::shared_ptr<const Telegram> telegram) {
for (const auto & emsdevice : emsdevices) {
if (telegram->operation != Telegram::Operation::RX_READ && emsdevice->is_device_id(src)) {
type_name = emsdevice->telegram_type_name(telegram);
break;
}
}
}
if (type_name.empty()) {
// 2nd fallback, get the type name from dest
for (const auto & emsdevice : emsdevices) {
if (telegram->operation != Telegram::Operation::RX_READ && emsdevice->is_device_id(dest)) {
type_name = emsdevice->telegram_type_name(telegram);
break;
}
}
}
// if we can't find names for the devices, use their hex values
if (src_name.empty()) {
src_name = device_tostring(src);