add negative filtering
This commit is contained in:
@@ -101,9 +101,13 @@ filter-seen = 5
|
|||||||
#filter-priority =
|
#filter-priority =
|
||||||
# include only messages having the specified circuit (partial match, alternatives and wildcard supported).
|
# include only messages having the specified circuit (partial match, alternatives and wildcard supported).
|
||||||
#filter-circuit =
|
#filter-circuit =
|
||||||
# include only messages having the specified name (partial match, alternatives and wildcard supported).
|
# exclude messages having the specified circuit (partial match, alternatives and wildcard supported).
|
||||||
|
#filter-non-circuit =
|
||||||
|
# include only messages having the specified name (partial match, alternatives and wildcard supported).
|
||||||
# HA integration: filter to some useful names for monitoring the heating circuit
|
# HA integration: filter to some useful names for monitoring the heating circuit
|
||||||
filter-name = status|temp|yield|count|energy|power|runtime|hours|starts|mode|curve|^load$|^party$
|
filter-name = status|temp|yield|count|energy|power|runtime|hours|starts|mode|curve|^load$|^party$
|
||||||
|
# exclude messages having the specified name (partial match, alternatives and wildcard supported).
|
||||||
|
#filter-non-name =
|
||||||
# include only messages having the specified level (partial match, alternatives and wildcard supported).
|
# include only messages having the specified level (partial match, alternatives and wildcard supported).
|
||||||
# Note: This is a filter on top of the messages already filtered implicitly for the ebusd "mqtt" user (if any).
|
# Note: This is a filter on top of the messages already filtered implicitly for the ebusd "mqtt" user (if any).
|
||||||
# Note: Since the empty string matches all levels, an explicit check for empty string (with "^$") needs to be used for
|
# Note: Since the empty string matches all levels, an explicit check for empty string (with "^$") needs to be used for
|
||||||
@@ -114,6 +118,9 @@ filter-level = ^$
|
|||||||
filter-direction = r|u
|
filter-direction = r|u
|
||||||
# include only fields having the specified name (partial match, alternatives and wildcard supported).
|
# include only fields having the specified name (partial match, alternatives and wildcard supported).
|
||||||
#filter-field =
|
#filter-field =
|
||||||
|
# exclude fields having the specified name (partial match, alternatives and wildcard supported).
|
||||||
|
# HA integration: exclude the useless sensor ok/cutoff info from temperature sensor.
|
||||||
|
filter-non-field = ^sensor$
|
||||||
|
|
||||||
|
|
||||||
# HA integration: home assistant configuration topics prefix
|
# HA integration: home assistant configuration topics prefix
|
||||||
|
|||||||
@@ -94,8 +94,12 @@ filter-seen = 1
|
|||||||
#filter-priority =
|
#filter-priority =
|
||||||
# include only messages having the specified circuit (partial match, alternatives and wildcard supported).
|
# include only messages having the specified circuit (partial match, alternatives and wildcard supported).
|
||||||
#filter-circuit =
|
#filter-circuit =
|
||||||
|
# exclude messages having the specified circuit (partial match, alternatives and wildcard supported).
|
||||||
|
#filter-non-circuit =
|
||||||
# include only messages having the specified name (partial match, alternatives and wildcard supported).
|
# include only messages having the specified name (partial match, alternatives and wildcard supported).
|
||||||
#filter-name =
|
#filter-name =
|
||||||
|
# exclude messages having the specified name (partial match, alternatives and wildcard supported).
|
||||||
|
#filter-non-name =
|
||||||
# include only messages having the specified level (partial match, alternatives and wildcard supported).
|
# include only messages having the specified level (partial match, alternatives and wildcard supported).
|
||||||
# Note: This is a filter on top of the messages already filtered implicitly for the ebusd "mqtt" user (if any).
|
# Note: This is a filter on top of the messages already filtered implicitly for the ebusd "mqtt" user (if any).
|
||||||
# Note: Since the empty string matches all levels, an explicit check for empty string (with "^$") needs to be used for
|
# Note: Since the empty string matches all levels, an explicit check for empty string (with "^$") needs to be used for
|
||||||
@@ -105,6 +109,8 @@ filter-level = ^$
|
|||||||
filter-direction = r|u
|
filter-direction = r|u
|
||||||
# include only fields having the specified name (partial match, alternatives and wildcard supported).
|
# include only fields having the specified name (partial match, alternatives and wildcard supported).
|
||||||
#filter-field =
|
#filter-field =
|
||||||
|
# exclude fields having the specified name (partial match, alternatives and wildcard supported).
|
||||||
|
filter-non-field = ^sensor$
|
||||||
|
|
||||||
|
|
||||||
# the field type mapped from variables named "type_map-%direction-%type" or "type_map-%type" as fallback with the
|
# the field type mapped from variables named "type_map-%direction-%type" or "type_map-%type" as fallback with the
|
||||||
|
|||||||
@@ -1347,7 +1347,8 @@ void MqttHandler::run() {
|
|||||||
ostringstream updates;
|
ostringstream updates;
|
||||||
unsigned int filterPriority = 0;
|
unsigned int filterPriority = 0;
|
||||||
unsigned int filterSeen = 0;
|
unsigned int filterSeen = 0;
|
||||||
string filterCircuit, filterName, filterLevel, filterField, filterDirection;
|
string filterCircuit, filterNonCircuit, filterName, filterNonName, filterField, filterNonField,
|
||||||
|
filterLevel, filterDirection;
|
||||||
vector<string> typeSwitchNames;
|
vector<string> typeSwitchNames;
|
||||||
if (m_hasDefinitionTopic) {
|
if (m_hasDefinitionTopic) {
|
||||||
result_t result = RESULT_OK;
|
result_t result = RESULT_OK;
|
||||||
@@ -1361,12 +1362,18 @@ void MqttHandler::run() {
|
|||||||
}
|
}
|
||||||
filterCircuit = m_replacers["filter-circuit"];
|
filterCircuit = m_replacers["filter-circuit"];
|
||||||
FileReader::tolower(&filterCircuit);
|
FileReader::tolower(&filterCircuit);
|
||||||
|
filterNonCircuit = m_replacers["filter-non-circuit"];
|
||||||
|
FileReader::tolower(&filterNonCircuit);
|
||||||
filterName = m_replacers["filter-name"];
|
filterName = m_replacers["filter-name"];
|
||||||
FileReader::tolower(&filterName);
|
FileReader::tolower(&filterName);
|
||||||
filterLevel = m_replacers["filter-level"];
|
filterNonName = m_replacers["filter-non-name"];
|
||||||
FileReader::tolower(&filterLevel);
|
FileReader::tolower(&filterNonName);
|
||||||
filterField = m_replacers["filter-field"];
|
filterField = m_replacers["filter-field"];
|
||||||
FileReader::tolower(&filterField);
|
FileReader::tolower(&filterField);
|
||||||
|
filterNonField = m_replacers["filter-non-field"];
|
||||||
|
FileReader::tolower(&filterNonField);
|
||||||
|
filterLevel = m_replacers["filter-level"];
|
||||||
|
FileReader::tolower(&filterLevel);
|
||||||
filterDirection = m_replacers["filter-direction"];
|
filterDirection = m_replacers["filter-direction"];
|
||||||
FileReader::tolower(&filterDirection);
|
FileReader::tolower(&filterDirection);
|
||||||
if (!m_typeSwitches.empty()) {
|
if (!m_typeSwitches.empty()) {
|
||||||
@@ -1451,7 +1458,9 @@ void MqttHandler::run() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!FileReader::matches(message->getCircuit(), filterCircuit, true, true)
|
if (!FileReader::matches(message->getCircuit(), filterCircuit, true, true)
|
||||||
|
|| (!filterNonCircuit.empty() && FileReader::matches(message->getCircuit(), filterNonCircuit, true, true))
|
||||||
|| !FileReader::matches(message->getName(), filterName, true, true)
|
|| !FileReader::matches(message->getName(), filterName, true, true)
|
||||||
|
|| (!filterNonName.empty() && FileReader::matches(message->getName(), filterNonName, true, true))
|
||||||
|| !FileReader::matches(message->getLevel(), filterLevel, true, true)) {
|
|| !FileReader::matches(message->getLevel(), filterLevel, true, true)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1491,7 +1500,8 @@ void MqttHandler::run() {
|
|||||||
if (fieldName.empty() && fieldCount == 1) {
|
if (fieldName.empty() && fieldCount == 1) {
|
||||||
fieldName = "0"; // might occur for unnamed single field sets
|
fieldName = "0"; // might occur for unnamed single field sets
|
||||||
}
|
}
|
||||||
if (!FileReader::matches(fieldName, filterField, true, true)) {
|
if (!FileReader::matches(fieldName, filterField, true, true)
|
||||||
|
|| (!filterNonField.empty() && FileReader::matches(fieldName, filterNonField, true, true))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const DataType* dataType = field->getDataType();
|
const DataType* dataType = field->getDataType();
|
||||||
|
|||||||
Reference in New Issue
Block a user