Add config flow to Folder Watcher (#30321)

This commit is contained in:
G Johansson 2024-04-23 15:59:46 +02:00 committed by GitHub
parent 6a0bee32f3
commit 05f7d265a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,7 @@ description: Integration for monitoring changes within the filesystem.
ha_category: ha_category:
- System monitor - System monitor
ha_iot_class: Local Polling ha_iot_class: Local Polling
ha_config_flow: true
ha_release: 0.67 ha_release: 0.67
ha_quality_scale: internal ha_quality_scale: internal
ha_domain: folder_watcher ha_domain: folder_watcher
@ -20,38 +21,12 @@ This integration adds [Watchdog](https://pythonhosted.org/watchdog/) file system
Configured folders must be added to [allowlist_external_dirs](/docs/configuration/basic/). Note that by default folder monitoring is recursive, meaning that the contents of sub-folders are also monitored. Configured folders must be added to [allowlist_external_dirs](/docs/configuration/basic/). Note that by default folder monitoring is recursive, meaning that the contents of sub-folders are also monitored.
## Configuration {% include integrations/config_flow.md %}
To enable the Folder Watcher integration in your installation, add the following to your `configuration.yaml` file:
```yaml
folder_watcher:
- folder: /config
```
{% configuration %}
folder:
description: The folder path
required: true
type: string
patterns:
description: Pattern matching to apply
required: false
default: "`*`"
type: string
{% endconfiguration %}
## Patterns ## Patterns
Pattern matching using [fnmatch](https://docs.python.org/3.6/library/fnmatch.html) can be used to limit filesystem monitoring to only files which match the configured patterns. The following example shows the configuration required to only monitor filetypes `.yaml` and `.txt`. Pattern matching using [fnmatch](https://docs.python.org/3.6/library/fnmatch.html) can be used to limit filesystem monitoring to only files which match the configured patterns.
As example to monitor specific file, as example YAML and text-files add `*.yaml` and `*.txt`.
```yaml
folder_watcher:
- folder: /config
patterns:
- '*.yaml'
- '*.txt'
```
## Automations ## Automations