mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2026-04-29 20:15:13 +00:00
check fetch length for custom entities, dev17
This commit is contained in:
@@ -387,10 +387,10 @@ void EMSdevice::toggle_fetch(uint16_t telegram_id, bool toggle) {
|
||||
}
|
||||
|
||||
// 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_) {
|
||||
if (tf.telegram_type_id_ == telegram_id) {
|
||||
return tf.fetch_;
|
||||
return tf.fetch_ && tf.length_ >= len;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -362,7 +362,7 @@ class EMSdevice {
|
||||
const char * telegram_type_name(std::shared_ptr<const Telegram> telegram);
|
||||
void fetch_values();
|
||||
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 has_telegram_id(uint16_t id) const;
|
||||
void ha_config_clear();
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define EMSESP_APP_VERSION "3.8.2-dev.16"
|
||||
#define EMSESP_APP_VERSION "3.8.2-dev.17"
|
||||
|
||||
@@ -686,7 +686,7 @@ void WebCustomEntityService::fetch() {
|
||||
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
|
||||
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)) {
|
||||
needFetch = false;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user