Change name of entity within WebUI #612

This commit is contained in:
proddy
2022-09-09 12:33:15 +02:00
parent 70f94322ee
commit df4aa64883
9 changed files with 115 additions and 31 deletions

View File

@@ -449,8 +449,14 @@ void EMSdevice::add_device_value(uint8_t tag,
}
});
// TODO
const __FlashStringHelper * custom_fullname;
custom_fullname = nullptr;
// add the device entity
devicevalues_.emplace_back(device_type_, tag, value_p, type, options, options_single, numeric_operator, short_name, fullname, uom, has_cmd, min, max, state);
devicevalues_.emplace_back(
device_type_, tag, value_p, type, options, options_single, numeric_operator, short_name, fullname, custom_fullname, uom, has_cmd, min, max, state);
// add a new command if it has a function attached
if (!has_cmd) {

View File

@@ -32,11 +32,12 @@ DeviceValue::DeviceValue(uint8_t device_type,
int8_t numeric_operator,
const __FlashStringHelper * const short_name,
const __FlashStringHelper * const * fullname,
uint8_t uom,
bool has_cmd,
int16_t min,
uint16_t max,
uint8_t state)
const __FlashStringHelper * const custom_fullname,
uint8_t uom,
bool has_cmd,
int16_t min,
uint16_t max,
uint8_t state)
: device_type(device_type)
, tag(tag)
, value_p(value_p)
@@ -46,6 +47,7 @@ DeviceValue::DeviceValue(uint8_t device_type,
, numeric_operator(numeric_operator)
, short_name(short_name)
, fullname(fullname)
, custom_fullname(custom_fullname)
, uom(uom)
, has_cmd(has_cmd)
, min(min)

View File

@@ -150,14 +150,15 @@ class DeviceValue {
const __FlashStringHelper * const ** options; // options as a flash char array
const __FlashStringHelper * const * options_single; // options are not translated
int8_t numeric_operator;
uint8_t options_size; // number of options in the char array, calculated
const __FlashStringHelper * const short_name; // used in MQTT and API
const __FlashStringHelper * const * fullname; // used in Web and Console, is translated
uint8_t uom; // DeviceValueUOM::*
bool has_cmd; // true if there is a Console/MQTT command which matches the short_name
int16_t min; // min range
uint16_t max; // max range
uint8_t state; // DeviceValueState::*
uint8_t options_size; // number of options in the char array, calculated
const __FlashStringHelper * const short_name; // used in MQTT and API
const __FlashStringHelper * const * fullname; // used in Web and Console, is translated
const __FlashStringHelper * const custom_fullname; // optional, from customization
uint8_t uom; // DeviceValueUOM::*
bool has_cmd; // true if there is a Console/MQTT command which matches the short_name
int16_t min; // min range
uint16_t max; // max range
uint8_t state; // DeviceValueState::*
DeviceValue(uint8_t device_type,
uint8_t tag,
@@ -168,6 +169,7 @@ class DeviceValue {
int8_t numeric_operator,
const __FlashStringHelper * const short_name,
const __FlashStringHelper * const * fullname,
const __FlashStringHelper * const custom_fullname,
uint8_t uom,
bool has_cmd,
int16_t min,