The previous cleanup implementation only iterated objects with
type === 'channel' and read entity_id from native. Both assumptions
break for entities written by older adapter versions: those exist as
flat states under hass.0.entities.<domain>.<entity_id>.<sub> with no
parent channel object and often no native.entity_id.
The admin UI shows them as folders because sub-states are present, but
`iobroker object get hass.0.entities.text.iob_…` returns "not found".
So the cleanup found nothing to delete even with valid patterns.
Refactor: iterate every object under entities.*, derive entity_id from
the first two path components after the namespace prefix, group by
entity_id, then delete each id individually (longest first, no
recursive flag — there is no parent to recurse into). Custom-config
protection still applies per entity group.
Works for both old flat-state and new channel+sub-state structures.
When enabled, on each adapter start the adapter scans all existing
hass.0.entities.* channels and deletes those whose entity_id matches
any of the configured excludePatterns. This complements the existing
filter (which only prevents new objects from being created) by also
cleaning up objects that were synced before the filter was activated
or before the patterns were extended.
Safety:
- Channels (and any of their sub-states) holding common.custom config
(history/influxdb/sql) are kept and a warning is logged so the user
can decide manually.
- Existing deleteStaleObjects() 50% sanity-guard is intentionally NOT
applied here — the user explicitly opted in to the cleanup.
- Per-id deletion only logs when verboseFilterLog is also active.
Default is false (opt-in). Adds new admin checkbox + i18n keys for all
11 languages (machine translations for non-en/de still pending).
The JSON Config schema for type 'text' enforces additionalProperties:false
and 'multiline' is not a documented property. Its presence caused the
admin UI to fail schema validation and refuse to render the panel.
Multi-line behaviour is already provided by 'minRows: 6' alone — the
schema explicitly states: "Set this attribute to 2 or more if you want
to have a textarea with more than one row."
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a new README section explaining the glob syntax, providing examples and
covering the verbose-logging toggle. Also adds a WORK IN PROGRESS changelog
entry for the next release.
New `verboseFilterLog` boolean (default `false`). When enabled, the initial
sync logs every excluded entity_id individually on INFO level. This is
useful when iterating on exclude patterns or verifying that the filter
catches the intended entities.
The verbose output is intentionally limited to the first sync. Subsequent
debouncedSync() calls only emit the aggregate count to avoid log spam
during normal operation. Live `state_changed` events for filtered entities
remain on DEBUG.
Admin UI gets a checkbox below the patterns field; i18n keys added for
all 11 supported languages.
JSON-Config field `excludePatterns` (multiline textarea, 6 rows by default,
full width). Help text explains the syntax: glob with `*`, `#` for comments,
empty = filter inactive.
i18n translations added for all 11 supported languages so the label and
help text are localised consistently with the rest of the admin UI.
Adapter now consults the exclude-pattern list (new `native.excludePatterns`
config option, multi-line string) at two points:
- `parseStates()` skips matching entities entirely. They are not registered
as ioBroker objects and no state is written. A summary INFO line reports
the count when the filter dropped anything from a sync.
- The `state_changed` event handler short-circuits matching live updates
with a DEBUG line, so a filtered entity that still emits state changes
in HA does not cause any churn in ioBroker.
Patterns are parsed once at adapter start: trimmed, empty lines and lines
starting with `#` are dropped. An empty resulting list means the filter is
inactive — adapter behaviour is then identical to the previous version.
Default config ships with example comments only, so existing installations
see no functional change after the update.
Glob-based entity_id matcher used by the upcoming exclude-filter feature.
Single wildcard `*` (matches any sequence including dots), all other characters
matched literally with regex metacharacters escaped. Case-sensitive, anchored.
Empty pattern array always returns false, so the helper is a no-op when the
adapter is not configured to filter anything.
New mocha unit-test suite invoked via `npm run test:unit` (separate from the
existing js-controller-backed test:integration).