mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-09-13 13:44:10 +00:00
Merge branch 'core3' into dev
This commit is contained in:
@@ -24,4 +24,6 @@ This release is based on the latest Espressif/Arduino core version 3. It brings
|
||||
- network fallback to AP only after start [#3090](https://github.com/emsesp/EMS-ESP32/issues/3090)
|
||||
- replaced Web async-validator with custom validator and toast with native snackbar to reduce bundle size
|
||||
- Gateway and Connect devices are shown in the Devices page, but disabled [3126](https://github.com/emsesp/EMS-ESP32/discussions/3126)
|
||||
- show control setting only for master thermostats (0x10) [#3173](https://github.com/emsesp/EMS-ESP32/issues/3173)
|
||||
- remove devices without entities not listed in 0x07 telegram
|
||||
|
||||
|
||||
+5981
-5995
File diff suppressed because it is too large
Load Diff
@@ -693,6 +693,10 @@ void EMSdevice::erase_device_values() {
|
||||
}
|
||||
}
|
||||
devicevalues_.clear();
|
||||
telegram_functions_.clear();
|
||||
handlers_ignored_.clear();
|
||||
handlers_config_.clear();
|
||||
handlers_broadcasted_.clear();
|
||||
}
|
||||
|
||||
// single list of options
|
||||
|
||||
+30
-5
@@ -173,12 +173,25 @@ uint8_t EMSESP::device_id_from_cmd(const uint8_t device_type, const char * cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// clears list of recognized devices
|
||||
void EMSESP::clear_all_devices() {
|
||||
// temporarily removed: clearing the list causes a crash, the associated commands and mqtt should also be removed.
|
||||
// emsdevices.clear(); // remove entries, but doesn't delete actual devices
|
||||
// remove a single device with all it's entities, commands, and telegrams
|
||||
void EMSESP::erase_device(const uint8_t type_id) {
|
||||
for (auto it = emsdevices.begin(); it < emsdevices.end(); it++) {
|
||||
if ((*it)->device_id() == type_id) {
|
||||
(*it)->erase_device_values();
|
||||
emsdevices.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clears list of recognized devices, entities and telegrams
|
||||
void EMSESP::clear_all_devices() {
|
||||
for (auto & emsdevice : emsdevices) {
|
||||
emsdevice->erase_device_values();
|
||||
}
|
||||
emsdevices.clear();
|
||||
}
|
||||
|
||||
// called from EMSdevice/Command whenever an entity or telegram handler is registered.
|
||||
// Devices reserve their value/telegram vectors generously (to avoid realloc storms while
|
||||
// heating circuits etc. are discovered incrementally), so once registration settles we
|
||||
@@ -1027,10 +1040,13 @@ void EMSESP::process_UBADevices(const std::shared_ptr<const Telegram> & telegram
|
||||
if (next_byte & 0x01) {
|
||||
// if we haven't already detected this device, request it's version details, unless its us (EMS-ESP)
|
||||
// when the version info is received, it will automagically add the device
|
||||
if ((device_id != EMSbus::ems_bus_id()) && !(EMSESP::device_exists(device_id))) {
|
||||
if ((device_id != EMSbus::ems_bus_id()) && !(device_exists(device_id))) {
|
||||
LOG_DEBUG("New EMS device detected with ID 0x%02X. Requesting version information.", device_id);
|
||||
send_read_request(EMSdevice::EMS_TYPE_VERSION, device_id);
|
||||
}
|
||||
} else if (device_exists(device_id) && !device_hasEntities(device_id)) {
|
||||
LOG_DEBUG("Remove EMS device with ID 0x%02X", device_id);
|
||||
erase_device(device_id); //
|
||||
}
|
||||
next_byte = next_byte >> 1; // advance 1 bit
|
||||
}
|
||||
@@ -1237,6 +1253,15 @@ bool EMSESP::process_telegram(const std::shared_ptr<const Telegram> & telegram)
|
||||
return telegram_found;
|
||||
}
|
||||
|
||||
bool EMSESP::device_hasEntities(const uint8_t device_id) {
|
||||
for (const auto & emsdevice : emsdevices) {
|
||||
if (emsdevice->is_device_id(device_id) && (emsdevice->count_entities() > 0)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false; // not found
|
||||
}
|
||||
|
||||
// return true if we have this device already registered
|
||||
bool EMSESP::device_exists(const uint8_t device_id) {
|
||||
if (emsdevices.empty()) {
|
||||
|
||||
@@ -152,6 +152,7 @@ class EMSESP {
|
||||
static void send_write_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset, const uint8_t value);
|
||||
static void send_write_request(const uint16_t type_id, const uint8_t dest, const uint8_t offset, const uint8_t value, const uint16_t validate_typeid);
|
||||
|
||||
static bool device_hasEntities(const uint8_t device_id);
|
||||
static bool device_exists(const uint8_t device_id);
|
||||
static void device_active(const uint8_t device_id, const bool active);
|
||||
static bool cmd_is_readonly(const uint8_t device_type, const uint8_t device_id, const char * cmd, const int8_t id);
|
||||
@@ -238,6 +239,7 @@ class EMSESP {
|
||||
|
||||
static bool add_device(const uint8_t device_id, const uint8_t product_id, const char * version, const uint8_t brand);
|
||||
static void scan_devices();
|
||||
static void erase_device(const uint8_t type_id);
|
||||
static void clear_all_devices();
|
||||
|
||||
// called whenever a device entity or telegram handler is registered, so we can
|
||||
|
||||
@@ -5180,7 +5180,7 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
||||
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_control2), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
||||
} else if (model == EMSdevice::EMS_DEVICE_FLAG_UI800) {
|
||||
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_control3), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
||||
} else {
|
||||
} else if (device_id() == 0x10) { // only master hermostats have control by remote
|
||||
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_control1), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
||||
}
|
||||
if (model != EMSdevice::EMS_DEVICE_FLAG_RC100 && model != EMSdevice::EMS_DEVICE_FLAG_CR120) {
|
||||
@@ -5484,7 +5484,9 @@ void Thermostat::register_device_values_hc(std::shared_ptr<Thermostat::HeatingCi
|
||||
FL_(nofrosttemp),
|
||||
DeviceValueUOM::DEGREES,
|
||||
MAKE_CF_CB(set_nofrosttemp));
|
||||
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_j_control), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
||||
if (device_id() == 0x10) { // only master hermostats have control by remote
|
||||
register_device_value(tag, &hc->control, DeviceValueType::ENUM, FL_(enum_j_control), FL_(control), DeviceValueUOM::NONE, MAKE_CF_CB(set_control));
|
||||
}
|
||||
register_device_value(tag, &hc->program, DeviceValueType::ENUM, FL_(enum_progMode4), FL_(program), DeviceValueUOM::NONE, MAKE_CF_CB(set_program));
|
||||
register_device_value(tag,
|
||||
&hc->remotetemp,
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.9.0-dev.0"
|
||||
#define EMSESP_APP_VERSION "3.9.0-dev.1"
|
||||
|
||||
Reference in New Issue
Block a user