dummylabs / thewatchman

Home Assistant custom integration to keep track of missing entities and services in your config files
MIT License
474 stars 19 forks source link

Feature request: entity whitelist (inverse of ignore rule) #121

Open danielrosehill opened 7 months ago

danielrosehill commented 7 months ago

I'm configuring Watchman to notify of unavailable lights (specifically).

Currently the only way for me to achieve this is to:

1: Run an offline entities report 2: Add all the notification groups I don't want to hear about by adding them as ignore options (scene., sensor. etc).

It would be great if there were the inverse option of ignore -- a whitelist (only report on entities matching these conditions).

Then I could just add: light.* to achieve the same functionality.

nbetcher commented 3 months ago

In theory there should be a way since (for some bizarre reason, versus re.match()) the author is using fnmatch() on each entity and service while building the list and, because of that, Unix filenaming globbing like this SHOULD work (but for some reason, doesn't):

!(notify.pushover)
+(!(notify.pushover))
?(!(notify.pushover))
@(!(notify.pushover))

(That assumes the only whitelisted entity or service would be notify.pushover and everything else gets blacklisted.)

Ideally it would be switched to re.match() since these in particular are not filenames in the first place (fnmatch() = File Name Match), then we could take the guess-work out of it and "simply" put:

^((?!notify\.pushover).)*$

Or yes, add a whitelist-only mode. ;)