Allow regexes for filtered_attributes, filtered_cache and filtered_optimistic options (#13047)

* Ensure filtered_attributes and filtered_optimistic are also regex

Bring filtered_attributes and filtered_optimistic in line with the newer filtered_cache.
All three of them are now regex matches instead of absolute matches.

* update tests to use regex ^$ anchors

* utils: add filterProperties
This commit is contained in:
Jorge Schrauwen authored and GitHub committed 2022-07-06 17:07:22 +02:00
1 parent 4a58dbf84c
commit db021e6711
6 files changed
+25 -20

No files matched your search

+1 -3
View File
@@ -266,9 +266,7 @@ class Controller {
}
// Filter mqtt message attributes
if (entity.options.filtered_attributes) {
entity.options.filtered_attributes.forEach((a) => delete message[a]);
}
utils.filterProperties(entity.options.filtered_attributes, message);
if (Object.entries(message).length) {
const output = settings.get().advanced.output;