merge PR #923 - fixes and the tested heatpump/heatsource entities by mvdp

This commit is contained in:
Proddy
2023-01-22 17:08:17 +01:00
parent 7f5e3d3b4c
commit bb24da92e4
25 changed files with 456 additions and 118 deletions

View File

@@ -496,6 +496,7 @@ void EMSdevice::add_device_value(uint8_t tag,
std::string custom_fullname = std::string(""); // custom fullname
auto short_name = name[0]; // entity name
bool has_cmd = (f != nullptr); // is it a command?
bool ignore = false; // ignore this entity?
// get fullname, getting translation if it exists
const char * const * fullname;
@@ -532,7 +533,8 @@ void EMSdevice::add_device_value(uint8_t tag,
if (shortname == entity) {
// get Mask
uint8_t mask = Helpers::hextoint(entity_id.substr(0, 2).c_str());
state = mask << 4; // set state high bits to flag, turn off active and ha flags
state = mask << 4; // set state high bits to flag, turn off active and ha flags
ignore = (mask & 0x80) == 0x80; // do not register
// see if there is a custom name in the entity string
if (has_custom_name) {
custom_fullname = entity_id.substr(custom_name_pos + 1);
@@ -544,6 +546,10 @@ void EMSdevice::add_device_value(uint8_t tag,
}
});
if (ignore) {
return;
}
// add the device entity
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);