This commit is contained in:
Proddy
2023-01-28 16:20:16 +01:00
parent 59af1fd62a
commit 94473bdeaa
9 changed files with 51 additions and 44 deletions

View File

@@ -124,7 +124,7 @@ const char * EMSdevice::device_type_2_device_name(const uint8_t device_type) {
case DeviceType::HEATSOURCE:
return F_(heatsource);
default:
return Helpers::translated_word(FL_(unknown));
return Helpers::translated_word(FL_(unknown), true);
}
}
@@ -159,7 +159,7 @@ const char * EMSdevice::device_type_2_device_name_translated() {
default:
break;
}
return Helpers::translated_word(FL_(unknown));
return Helpers::translated_word(FL_(unknown_device));
}
// returns device_type from a non-translated EN string
@@ -474,6 +474,7 @@ void EMSdevice::add_device_value(uint8_t tag,
uint16_t max) {
// initialize the device value depending on it's type
// ignoring DeviceValueType::CMD and DeviceValueType::TIME
if (type == DeviceValueType::STRING) {
*(char *)(value_p) = {'\0'}; // this is important for string functions like strlen() to work later
} else if (type == DeviceValueType::INT) {

View File

@@ -446,11 +446,11 @@ class EMSdevice {
bool ha_config_firstrun_ = true; // this means a first setup of HA is needed after a restart
struct TelegramFunction {
uint16_t telegram_type_id_; // it's type_id
const char * telegram_type_name_; // e.g. RC20Message
bool fetch_; // if this type_id be queried automatically
bool received_;
process_function_p process_function_;
const uint16_t telegram_type_id_; // it's type_id
const char * telegram_type_name_; // e.g. RC20Message
bool fetch_; // if this type_id be queried automatically
bool received_;
const process_function_p process_function_;
TelegramFunction(uint16_t telegram_type_id, const char * telegram_type_name, bool fetch, bool received, const process_function_p process_function)
: telegram_type_id_(telegram_type_id)

View File

@@ -1070,41 +1070,45 @@ bool EMSESP::add_device(const uint8_t device_id, const uint8_t product_id, const
// check for known device IDs
if (device_id == EMSdevice::EMS_DEVICE_ID_RFSENSOR) {
// see: https://github.com/emsesp/EMS-ESP32/issues/103#issuecomment-911717342 and https://github.com/emsesp/EMS-ESP32/issues/624
name = "rf room temperature sensor";
name = "RF room temperature sensor";
device_type = DeviceType::THERMOSTAT;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_ROOMTHERMOSTAT) {
name = "generic thermostat";
name = "Generic thermostat";
device_type = DeviceType::THERMOSTAT;
flags = DeviceFlags::EMS_DEVICE_FLAG_RC10 | DeviceFlags::EMS_DEVICE_FLAG_NO_WRITE;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_RS232) {
name = "RS232";
device_type = DeviceType::CONNECT;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_TERMINAL) {
name = "terminal";
name = "Terminal";
device_type = DeviceType::CONNECT;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_SERVICEKEY) {
name = "service key";
name = "Service Key";
device_type = DeviceType::CONNECT;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_CASCADE) {
name = "cascade";
name = "Cascade";
device_type = DeviceType::CONNECT;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_EASYCOM) {
// see https://github.com/emsesp/EMS-ESP/issues/460#issuecomment-709553012
name = "modem";
name = "Modem";
device_type = DeviceType::CONNECT;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_CONVERTER) {
name = "converter"; // generic
name = "Converter"; // generic
} else if (device_id == EMSdevice::EMS_DEVICE_ID_CLOCK) {
name = "clock"; // generic
name = "Clock"; // generic
device_type = DeviceType::CONTROLLER;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_CONTROLLER) {
name = "generic controller";
name = "Generic Controller";
device_type = DeviceType::CONTROLLER;
} else if (device_id == EMSdevice::EMS_DEVICE_ID_BOILER) {
name = "generic boiler";
name = "Generic Boiler";
device_type = DeviceType::BOILER;
flags = DeviceFlags::EMS_DEVICE_FLAG_HEATPUMP;
LOG_WARNING("Unknown EMS boiler. Using generic profile. Please report on GitHub.");
} else if (device_id >= 0x68 && device_id <= 0x6F) {
// test for https://github.com/emsesp/EMS-ESP32/issues/882
name = "Cascaded Controller";
device_type = DeviceType::CONTROLLER;
} else {
LOG_WARNING("Unrecognized EMS device (device ID 0x%02X, no product ID). Please report on GitHub.", device_id);
return false;

View File

@@ -47,6 +47,7 @@ MAKE_PSTR_LIST(alert_device, "Alert Module", "Alarmmodul", "Alert Module", "Larm
MAKE_PSTR_LIST(pump_device, "Pump Module", "Pumpenmodul", "Pump Module", "Pumpmodul")
MAKE_PSTR_LIST(heatsource_device, "Heatsource", "Heizquelle", "Heatsource", "Värmekälla")
MAKE_PSTR_LIST(sensors_device, "Sensors", "Sensoren", "Sensoren", "Sensorer", "czujniki", "Sensorer", "Capteurs")
MAKE_PSTR_LIST(unknown_device, "Unknown", "Unbekannt", "Onbekend", "Okänt", "Nieznane urządzenie", "Ukjent", "Inconnu")
// commands
MAKE_PSTR_LIST(info_cmd, "lists all values", "Liste aller Werte")