thewatchman icon indicating copy to clipboard operation
thewatchman copied to clipboard

Exclude description sections of automations.yaml (entities noted in comment sections)

Open bcutter opened this issue 2 years ago • 5 comments

Problem: Currently Watchman also finds and lists entities which are used in the comment sections of automations. This triggers false positives - and makes (based on the intensity of individual documentation/commenting) using this basically absolutely great integration a bit useless. 😞

Feature Request: Ignore all entites from the description: sections of automations.yaml

Example:

+--------------------------------------------------------------+-----------------+--------------------------------------------------------------+
| Entity ID                                                    | State           | Location                                                     |
+--------------------------------------------------------------+-----------------+--------------------------------------------------------------+
| group.anwesenheit_zuhause                                    | missing         | automations.yaml:1575,3896,4151,8725                         |

Actual automations.yaml snippet:

- id: 'XXXXXXXXXXXXXX'
  alias: Automation
  description: '...
    ...
    - Von "group.anwesenheit_zuhause" (state: home|not_home) auf "zone.home" (numeric_state:
    0|!0) umgestellt
    ...'

This should remove false positives massively. Looking at some (former) issues and reports, plenty of those findings for others too.

Manually setting those entities on the ignore list is only workaround - if at all.

bcutter avatar Dec 26 '22 20:12 bcutter

Plus (more improvement to reduce false positives):

  • ignore everything with example: domain.entity_id from /config/custom_components (example: as keyword) (again: https://github.com/dummylabs/thewatchman#ignored-files-option-example is just a workaround for this)

bcutter avatar Dec 26 '22 20:12 bcutter

  • ignore everything with example: domain.entity_id from /config/custom_components (example: as keyword) (again: https://github.com/dummylabs/thewatchman#ignored-files-option-example is just a workaround for this)

This part is pretty much same as https://github.com/dummylabs/thewatchman/issues/56

Hiekkaharju avatar Dec 26 '22 20:12 Hiekkaharju

You're right. So ignore that additional post for now and let's focus on the original one.

At the same time both share the same target - getting rid of unnecessary false positives.

bcutter avatar Dec 26 '22 21:12 bcutter

Meanwhile I discovered that the integration alreay ignores certain entities, usually when there's a # close or directly before the entity, e. g. this is a text and this is a #sensor.entity.

Unfortunately, that's not enough for the basic issue, as comment sections spread over a certain amount of text. But maybe this "comment section detection" can be extended to also address and solve this issue.

bcutter avatar Dec 28 '22 00:12 bcutter

This also affects automation blueprints which are not deployed.

input: power_sensor_1_entity: name: Power Sensor 1 description: This is the main power sensor that will be used to measure load (e.g. sensor.main_meter_power) selector: entity: filter: - domain: sensor device_class: power

image

DataBitz avatar Sep 09 '23 01:09 DataBitz

In version 0.6.4 single-line description: and example: fields will be excluded from parsing. As far as I can see, multiline descriptions are not prohibited in YAML configuration, but they are not encouraged by the Home Assistant UI. For example, in the automations editor, they are collapsed into a single line when displayed or updated via the UI.

Supporting multiline descriptions in parsing requires significant changes, we might address this later.

dummylabs avatar Nov 22 '24 08:11 dummylabs

I really like the recent work you are putting in this integration.

Looking forward to see the improvement running 0.6.4. Any estimations when it will be released?

bcutter avatar Nov 22 '24 11:11 bcutter

Thanks for the kind words! It's almost ready, just polishing minor details and running some real-world tests before publishing. There were a lot of changes and refactoring under the hood, so I expect there may be some bugs not covered by the unit tests. Hopefully, this will make future development easier.

dummylabs avatar Nov 22 '24 15:11 dummylabs

Unfortunately this is not working correctly. What is excluded and ignored by Watchman, is stuff like #This is a comment mentioning the unavailable but ignorable entity cover.funny_name

What is still NOT working (the update even discovered new false positive findings!) is stuff like:

- id: 'xxxxx
  alias: Notification Automation
  description: 'Text Text Text
    Update 2024-08-01:

    - CHANGE: Wechsel von "binary_sensor.updater_nextcloud" zu nativer "update.nextcloud",

Now there's e. g. update.nextloud on the report:

+--------------------------------------------------------------+-----------------+--------------------------------------------------------------+
| Entity ID                                                    | State           | Location                                                     |
+--------------------------------------------------------------+-----------------+--------------------------------------------------------------+
| update.nextcloud                                             | missing         | automations.yaml:9434                                        |

So at the moment it's not working as I was hoping it should, looks like only half the way is gone so far. Please explicitly exclude everything from the description sections too @dummylabs

bcutter avatar Jul 27 '25 20:07 bcutter