mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 00:09:51 +03:00
fix ignore entity, add weblog level OFF
This commit is contained in:
@@ -210,6 +210,7 @@ const SystemLog: FC = () => {
|
|||||||
margin="normal"
|
margin="normal"
|
||||||
select
|
select
|
||||||
>
|
>
|
||||||
|
<MenuItem value={-1}>OFF</MenuItem>
|
||||||
<MenuItem value={3}>ERROR</MenuItem>
|
<MenuItem value={3}>ERROR</MenuItem>
|
||||||
<MenuItem value={4}>WARNING</MenuItem>
|
<MenuItem value={4}>WARNING</MenuItem>
|
||||||
<MenuItem value={5}>NOTICE</MenuItem>
|
<MenuItem value={5}>NOTICE</MenuItem>
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ void EMSdevice::add_device_value(uint8_t tag,
|
|||||||
std::string custom_fullname = std::string(""); // custom fullname
|
std::string custom_fullname = std::string(""); // custom fullname
|
||||||
auto short_name = name[0]; // entity name
|
auto short_name = name[0]; // entity name
|
||||||
bool has_cmd = (f != nullptr); // is it a command?
|
bool has_cmd = (f != nullptr); // is it a command?
|
||||||
|
bool ignore = false; // ignore this entity?
|
||||||
|
|
||||||
// get fullname, getting translation if it exists
|
// get fullname, getting translation if it exists
|
||||||
const char * const * fullname;
|
const char * const * fullname;
|
||||||
@@ -524,9 +525,7 @@ void EMSdevice::add_device_value(uint8_t tag,
|
|||||||
// get Mask
|
// get Mask
|
||||||
uint8_t mask = Helpers::hextoint(entity_id.substr(0, 2).c_str());
|
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
|
||||||
if (mask & 0x80) {
|
ignore = (mask & 0x80) == 0x80; // do not register
|
||||||
return;
|
|
||||||
}
|
|
||||||
// see if there is a custom name in the entity string
|
// see if there is a custom name in the entity string
|
||||||
if (has_custom_name) {
|
if (has_custom_name) {
|
||||||
custom_fullname = entity_id.substr(custom_name_pos + 1);
|
custom_fullname = entity_id.substr(custom_name_pos + 1);
|
||||||
@@ -537,6 +536,9 @@ void EMSdevice::add_device_value(uint8_t tag,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (ignore) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// add the device entity
|
// add the device entity
|
||||||
devicevalues_.emplace_back(
|
devicevalues_.emplace_back(
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ void WebLogService::start() {
|
|||||||
limit_log_messages_ = maximum_log_messages_;
|
limit_log_messages_ = maximum_log_messages_;
|
||||||
compact_ = settings.weblog_compact;
|
compact_ = settings.weblog_compact;
|
||||||
uuid::log::Logger::register_handler(this, (uuid::log::Level)settings.weblog_level);
|
uuid::log::Logger::register_handler(this, (uuid::log::Level)settings.weblog_level);
|
||||||
|
if ((uuid::log::Level)settings.weblog_level == uuid::log::Level::OFF) {
|
||||||
|
log_messages_.clear();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +75,9 @@ void WebLogService::log_level(uuid::log::Level level) {
|
|||||||
},
|
},
|
||||||
"local");
|
"local");
|
||||||
uuid::log::Logger::register_handler(this, level);
|
uuid::log::Logger::register_handler(this, level);
|
||||||
|
if (level == uuid::log::Level::OFF) {
|
||||||
|
log_messages_.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t WebLogService::num_log_messages() const {
|
size_t WebLogService::num_log_messages() const {
|
||||||
|
|||||||
Reference in New Issue
Block a user