Merge branch 'dev' into core3

This commit is contained in:
MichaelDvP
2026-04-21 20:44:02 +02:00
7 changed files with 16 additions and 19 deletions

View File

@@ -20,6 +20,7 @@ For more details go to [emsesp.org](https://emsesp.org/).
- SRC climate creation [#2936](https://github.com/emsesp/EMS-ESP32/issues/2936) and [#2960](https://github.com/emsesp/EMS-ESP32/issues/2960) - SRC climate creation [#2936](https://github.com/emsesp/EMS-ESP32/issues/2936) and [#2960](https://github.com/emsesp/EMS-ESP32/issues/2960)
- missing translations [#3015](https://github.com/emsesp/EMS-ESP32/issues/3015) - missing translations [#3015](https://github.com/emsesp/EMS-ESP32/issues/3015)
- custom entities check fetch length
## Changed ## Changed

View File

@@ -70,16 +70,12 @@ void ArduinoJsonJWT::parseJWT(String jwt, JsonDocument & jsonDocument) {
*/ */
String ArduinoJsonJWT::sign(String & payload) { String ArduinoJsonJWT::sign(String & payload) {
std::array<unsigned char, 32> hmacResult{}; std::array<unsigned char, 32> hmacResult{};
{ mbedtls_md_hmac(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256),
mbedtls_md_context_t ctx; reinterpret_cast<const unsigned char *>(_secret.c_str()),
mbedtls_md_type_t md_type = MBEDTLS_MD_SHA256; _secret.length(),
mbedtls_md_init(&ctx); reinterpret_cast<const unsigned char *>(payload.c_str()),
mbedtls_md_setup(&ctx, mbedtls_md_info_from_type(md_type), 1); payload.length(),
mbedtls_md_hmac_starts(&ctx, reinterpret_cast<const unsigned char *>(_secret.c_str()), _secret.length()); hmacResult.data());
mbedtls_md_hmac_update(&ctx, reinterpret_cast<const unsigned char *>(payload.c_str()), payload.length());
mbedtls_md_hmac_finish(&ctx, hmacResult.data());
mbedtls_md_free(&ctx);
}
return encode(reinterpret_cast<const char *>(hmacResult.data()), hmacResult.size()); return encode(reinterpret_cast<const char *>(hmacResult.data()), hmacResult.size());
} }

View File

@@ -387,10 +387,10 @@ void EMSdevice::toggle_fetch(uint16_t telegram_id, bool toggle) {
} }
// get status of automatic fetch for a telegramID // get status of automatic fetch for a telegramID
bool EMSdevice::is_fetch(uint16_t telegram_id) const { bool EMSdevice::is_fetch(uint16_t telegram_id, uint8_t len) const {
for (const auto & tf : telegram_functions_) { for (const auto & tf : telegram_functions_) {
if (tf.telegram_type_id_ == telegram_id) { if (tf.telegram_type_id_ == telegram_id) {
return tf.fetch_; return tf.fetch_ && tf.length_ >= len;
} }
} }
return false; return false;

View File

@@ -362,7 +362,7 @@ class EMSdevice {
const char * telegram_type_name(std::shared_ptr<const Telegram> telegram); const char * telegram_type_name(std::shared_ptr<const Telegram> telegram);
void fetch_values(); void fetch_values();
void toggle_fetch(uint16_t telegram_id, bool toggle); void toggle_fetch(uint16_t telegram_id, bool toggle);
bool is_fetch(uint16_t telegram_id) const; bool is_fetch(uint16_t telegram_id, uint8_t len = 0) const;
bool is_received(uint16_t telegram_id) const; bool is_received(uint16_t telegram_id) const;
bool has_telegram_id(uint16_t id) const; bool has_telegram_id(uint16_t id) const;
void ha_config_clear(); void ha_config_clear();

View File

@@ -202,7 +202,7 @@ Thermostat::Thermostat(uint8_t device_type, uint8_t device_id, uint8_t product_i
if (model == EMSdevice::EMS_DEVICE_FLAG_RC100) { if (model == EMSdevice::EMS_DEVICE_FLAG_RC100) {
register_telegram_type(0x43F, "CRHolidays", true, MAKE_PF_CB(process_RC300Holiday), 6); register_telegram_type(0x43F, "CRHolidays", true, MAKE_PF_CB(process_RC300Holiday), 6);
} else { } else {
register_telegram_type(0x269, "RC300Holiday", true, MAKE_PF_CB(process_RC300Holiday), 6); register_telegram_type(0x269, "RC300Holiday", true, MAKE_PF_CB(process_RC300Holiday), 18);
} }
register_telegram_type(0x16E, "Absent", true, MAKE_PF_CB(process_Absent), 1); register_telegram_type(0x16E, "Absent", true, MAKE_PF_CB(process_Absent), 1);
register_telegram_type(0xBF, "ErrorMessage", false, MAKE_PF_CB(process_ErrorMessageBF)); register_telegram_type(0xBF, "ErrorMessage", false, MAKE_PF_CB(process_ErrorMessageBF));

View File

@@ -686,7 +686,7 @@ void WebCustomEntityService::fetch() {
uint8_t stop = (entity.offset + len[entity.value_type]) % fetchblock; uint8_t stop = (entity.offset + len[entity.value_type]) % fetchblock;
bool is_fetched = start < fetchblock && stop < fetchblock; // make sure the complete value is a a fetched block bool is_fetched = start < fetchblock && stop < fetchblock; // make sure the complete value is a a fetched block
for (const auto & emsdevice : EMSESP::emsdevices) { for (const auto & emsdevice : EMSESP::emsdevices) {
if (emsdevice->is_device_id(entity.device_id) && emsdevice->is_fetch(entity.type_id) if (emsdevice->is_device_id(entity.device_id) && emsdevice->is_fetch(entity.type_id, entity.offset + len[entity.value_type])
&& (is_fetched || entity.value_type == DeviceValueType::STRING)) { && (is_fetched || entity.value_type == DeviceValueType::STRING)) {
needFetch = false; needFetch = false;
break; break;

View File

@@ -296,10 +296,6 @@ uint8_t WebStatusService::upgradeImportantMessages(std::string & version) {
version::EMSESP_Version current_version(current_version_s); // get current version version::EMSESP_Version current_version(current_version_s); // get current version
if (latest_version > current_version && current_version.minor() < latest_version.minor()) {
return 0; // if it's just a minor version upgrade return 0
}
if ((current_version.major() <= 3 && current_version.minor() <= 8) && (latest_version.major() == 3 && latest_version.minor() == 9)) { if ((current_version.major() <= 3 && current_version.minor() <= 8) && (latest_version.major() == 3 && latest_version.minor() == 9)) {
return 1; // if moving from below 3.8.x to 3.9.x return 1 return 1; // if moving from below 3.8.x to 3.9.x return 1
} }
@@ -308,6 +304,10 @@ uint8_t WebStatusService::upgradeImportantMessages(std::string & version) {
return 2; // if it's a major version upgrade return 2 return 2; // if it's a major version upgrade return 2
} }
if (latest_version > current_version && current_version.minor() < latest_version.minor()) {
return 0; // if it's just a minor version upgrade return 0
}
return 0; // if it's not a valid version upgrade return 0 return 0; // if it's not a valid version upgrade return 0
} }