add devices alert/Pump #575, #720, UOM:translate times? #752

This commit is contained in:
MichaelDvP
2022-11-19 12:11:30 +01:00
parent 8594c4a7eb
commit deda1daa04
11 changed files with 172 additions and 17 deletions

View File

@@ -56,6 +56,17 @@ std::string EMSdevice::uom_to_string(uint8_t uom) {
if (EMSESP::system_.fahrenheit() && (uom == DeviceValueUOM::DEGREES || uom == DeviceValueUOM::DEGREES_R)) {
return (DeviceValue::DeviceValueUOM_s[DeviceValueUOM::FAHRENHEIT]);
}
/* 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]);
}
@@ -107,6 +118,10 @@ const char * EMSdevice::device_type_2_device_name(const uint8_t device_type) {
return F_(switch);
case DeviceType::GATEWAY:
return F_(gateway);
case DeviceType::ALERT:
return F_(alert);
case DeviceType::PUMP:
return F_(pump);
default:
return Helpers::translated_word(FL_(unknown));
}
@@ -128,42 +143,39 @@ uint8_t EMSdevice::device_name_2_device_type(const char * topic) {
if (!strcmp(lowtopic, F_(boiler))) {
return DeviceType::BOILER;
}
if (!strcmp(lowtopic, F_(thermostat))) {
return DeviceType::THERMOSTAT;
}
if (!strcmp(lowtopic, F_(system))) {
return DeviceType::SYSTEM;
}
if (!strcmp(lowtopic, F_(heatpump))) {
return DeviceType::HEATPUMP;
}
if (!strcmp(lowtopic, F_(solar))) {
return DeviceType::SOLAR;
}
if (!strcmp(lowtopic, F_(mixer))) {
return DeviceType::MIXER;
}
if (!strcmp(lowtopic, F_(dallassensor))) {
return DeviceType::DALLASSENSOR;
}
if (!strcmp(lowtopic, F_(analogsensor))) {
return DeviceType::ANALOGSENSOR;
}
if (!strcmp(lowtopic, F_(switch))) {
return DeviceType::SWITCH;
}
if (!strcmp(lowtopic, F_(gateway))) {
return DeviceType::GATEWAY;
}
if (!strcmp(lowtopic, F_(alert))) {
return DeviceType::ALERT;
}
if (!strcmp(lowtopic, F_(pump))) {
return DeviceType::PUMP;
}
return DeviceType::UNKNOWN;
}