fix console show values #682

This commit is contained in:
MichaelDvP
2022-10-13 14:08:53 +02:00
parent 9be13eb0b9
commit e4445413fd

View File

@@ -325,17 +325,7 @@ void EMSESP::show_device_values(uuid::console::Shell & shell) {
shell.printf(" %s: ", key); shell.printf(" %s: ", key);
JsonVariant data = p.value(); JsonVariant data = p.value();
shell.print(COLOR_BRIGHT_GREEN); shell.print(COLOR_BRIGHT_GREEN);
if (data.is<const char *>()) { shell.print(data.as<std::string>());
shell.print(data.as<const char *>());
} else if (data.is<int>()) {
shell.print(data.as<int>());
} else if (data.is<float>()) {
char s[10];
shell.print(Helpers::render_value(s, data.as<float>(), 1));
} else if (data.is<bool>()) {
shell.print(data.as<bool>() ? Helpers::translated_word(FL_(on)) : Helpers::translated_word(FL_(off)));
}
// if there is a uom print it // if there is a uom print it
std::string uom = emsdevice->get_value_uom(key); std::string uom = emsdevice->get_value_uom(key);
if (uom == "°C" && EMSESP::system_.fahrenheit()) { if (uom == "°C" && EMSESP::system_.fahrenheit()) {