dummylabs / thewatchman

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

Ignore example entities in custom_components #25

Closed emcniece closed 2 years ago

emcniece commented 2 years ago

Hey, thanks for this great integration! I'm setting it up for the first time and narrowing down some missing entities. I've noticed that many false positives are being generated from files like service.yaml inside custom_components.

For example:

-== Missing 4 entity(ies) from 17 found in your config:
+--------------------------------+---------+--------------------------------------------------------------+
| Entity ID                      | State   | Location                                                     |
+--------------------------------+---------+--------------------------------------------------------------+
| sensor.station_name            | missing | custom_components/opensprinkler/services.yaml:6,18           |
| fan.office_purifier            | missing | custom_components/coway/services.yaml:7,19                   |
| sensor.general_waste           | missing | custom_components/garbage_collection/services.yaml:9,21,33,4 |
|                                |         | 8,60                                                         |

The garbage collection file is a good example: https://github.com/bruxy70/Garbage-Collection/blob/master/custom_components/garbage_collection/services.yaml. On closer investigation, the false positive appears to be an example like so:

  fields:
    entity_id:
      description: The garbage_collection sensor entity_id
      example: sensor.general_waste

It's easy enough to add each of these directories to the ignore_files config, and that's what I'm doing now. I tried excluding entities like example.* but of course that didn't work. Is there an easier to way to bulk ignore these examples? Thank you for your time!

dummylabs commented 2 years ago

Hey @emcniece, that's correct, "ignored files" configuration setting was designed for this purpose. You can use asterisk to bulk ignore all nested files within a directory. I'd suggest to completely exclude custom_components folder from watchman monitoring as you cannot control its content in most cases. For example my own configuration (as well as example config from readme) contains 3 folders I'd like watchman not to dig into: /config/esphome/*, /config/appdaemon/*, /config/custom_components/* and it works just fine.

Bodge-IT commented 2 years ago

The ignored files doesn't seem to work. I've tried leading slash, no leading slash, leading '/config' no leading '/config', wrap in "", no wrap in "", path/to/file, no/path/to/file, wildcards (in "" of course, I RTFM'd). I could not get either of my files to be excluded. Fell back to individual entities excluded for the win.

Configured through UI, not in yaml. Great tool, thanks.

emcniece commented 2 years ago

Closing as the original question has been answered. Thanks for the help!