mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
translating UOMs hours/minutes/seconds
This commit is contained in:
@@ -51,23 +51,21 @@ std::string EMSdevice::tag_to_mqtt(uint8_t tag) {
|
|||||||
return (DeviceValue::DeviceValueTAG_mqtt[tag]);
|
return (DeviceValue::DeviceValueTAG_mqtt[tag]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert UOM to a string - these don't need translating
|
// convert UOM to a string - translating only for hours/minutes/seconds
|
||||||
std::string EMSdevice::uom_to_string(uint8_t uom) {
|
std::string EMSdevice::uom_to_string(uint8_t uom) {
|
||||||
if (EMSESP::system_.fahrenheit() && (uom == DeviceValueUOM::DEGREES || uom == DeviceValueUOM::DEGREES_R)) {
|
switch (uom) {
|
||||||
return (DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT]);
|
case DeviceValueUOM::DEGREES:
|
||||||
|
case DeviceValueUOM::DEGREES_R:
|
||||||
|
return EMSESP::system_.fahrenheit() ? DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT] : DeviceValue::DeviceValueUOM_s[uom];
|
||||||
|
case DeviceValueUOM::HOURS:
|
||||||
|
return Helpers::translated_word(FL_(hours));
|
||||||
|
case DeviceValueUOM::MINUTES:
|
||||||
|
return Helpers::translated_word(FL_(minutes));
|
||||||
|
case DeviceValueUOM::SECONDS:
|
||||||
|
return Helpers::translated_word(FL_(seconds));
|
||||||
|
default:
|
||||||
|
return DeviceValue::DeviceValueUOM_s[uom];
|
||||||
}
|
}
|
||||||
/* translate times? https://github.com/emsesp/EMS-ESP32/issues/752
|
|
||||||
if (uom == DeviceValueUOM::HOURS) {
|
|
||||||
return (Helpers::translated_word(FL_(hours)));
|
|
||||||
}
|
|
||||||
if (uom == DeviceValueUOM::MINUTES) {
|
|
||||||
return (Helpers::translated_word(FL_(minutes)));
|
|
||||||
}
|
|
||||||
if (uom == DeviceValueUOM::SECONDS) {
|
|
||||||
return (Helpers::translated_word(FL_(seconds)));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return (DeviceValue::DeviceValueUOM_s[uom]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EMSdevice::brand_to_string() const {
|
std::string EMSdevice::brand_to_string() const {
|
||||||
|
|||||||
@@ -112,14 +112,14 @@ const char * DeviceValue::DeviceValueUOM_s[] = {
|
|||||||
F_(uom_lmin),
|
F_(uom_lmin),
|
||||||
F_(uom_kwh),
|
F_(uom_kwh),
|
||||||
F_(uom_wh),
|
F_(uom_wh),
|
||||||
F_(uom_hours),
|
FL_(hours)[0],
|
||||||
F_(uom_minutes),
|
FL_(minutes)[0],
|
||||||
F_(uom_ua),
|
F_(uom_ua),
|
||||||
F_(uom_bar),
|
F_(uom_bar),
|
||||||
F_(uom_kw),
|
F_(uom_kw),
|
||||||
F_(uom_w),
|
F_(uom_w),
|
||||||
F_(uom_kb),
|
F_(uom_kb),
|
||||||
F_(uom_seconds),
|
FL_(seconds)[0],
|
||||||
F_(uom_dbm),
|
F_(uom_dbm),
|
||||||
F_(uom_fahrenheit),
|
F_(uom_fahrenheit),
|
||||||
F_(uom_mv),
|
F_(uom_mv),
|
||||||
|
|||||||
@@ -197,13 +197,10 @@ MAKE_PSTR_LIST(tpl_input, "Format: <inv>[<evu1><evu2><evu3><comp><aux><cool><hea
|
|||||||
MAKE_PSTR_LIST(tpl_input4, "Format: <inv>[<comp><aux><cool><heat><dhw><pv>]")
|
MAKE_PSTR_LIST(tpl_input4, "Format: <inv>[<comp><aux><cool><heat><dhw><pv>]")
|
||||||
|
|
||||||
// Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp
|
// Unit Of Measurement mapping - maps to DeviceValueUOM_s in emsdevice.cpp
|
||||||
// These don't need translating, it will mess up HA and the API
|
// Translating hours/minute/seconds in emsdevice.cpp
|
||||||
MAKE_PSTR(uom_blank, " ")
|
MAKE_PSTR(uom_blank, " ")
|
||||||
MAKE_PSTR(uom_percent, "%")
|
MAKE_PSTR(uom_percent, "%")
|
||||||
MAKE_PSTR(uom_degrees, "°C")
|
MAKE_PSTR(uom_degrees, "°C")
|
||||||
MAKE_PSTR(uom_hours, "hours")
|
|
||||||
MAKE_PSTR(uom_minutes, "minutes")
|
|
||||||
MAKE_PSTR(uom_seconds, "seconds")
|
|
||||||
MAKE_PSTR(uom_kwh, "kWh")
|
MAKE_PSTR(uom_kwh, "kWh")
|
||||||
MAKE_PSTR(uom_wh, "Wh")
|
MAKE_PSTR(uom_wh, "Wh")
|
||||||
MAKE_PSTR(uom_bar, "bar")
|
MAKE_PSTR(uom_bar, "bar")
|
||||||
|
|||||||
Reference in New Issue
Block a user