From 7ad31e632d0f8a4d7e9cbcec327ac3186c15d2e4 Mon Sep 17 00:00:00 2001 From: mampfes Date: Tue, 7 Feb 2023 20:09:55 +0100 Subject: [PATCH 1/2] add examples for template variables --- doc/installation.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/installation.md b/doc/installation.md index c0fc464b..9e45c9ab 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -139,6 +139,14 @@ The following variables can be used within `value_template` and `date_template`: | `value.daysTo` | Days to collection | int | 0 = today, 1 = tomorrow, etc | | `value.types` | Waste types | list of strings | Use `join` filter to join types | +Examples: + +```yaml + value_template: '{{value.types|join(", ")}}' + value_template: 'in {{value.daysTo}} days' + value_template: 'on {{value.date.strftime("%a")}}, {{value.date.strftime("%d.%m.%Y")}}' +``` + ## Combine Data from multiple Sources To combine data from multiple sources into one sensor, just add the source indexes like that: From 671ff0c7a2e34b4ada89a11c74c3fe7541989cf8 Mon Sep 17 00:00:00 2001 From: mampfes Date: Tue, 7 Feb 2023 20:18:33 +0100 Subject: [PATCH 2/2] improve docu separate docu for sources and customize (one table per level) --- doc/installation.md | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/doc/installation.md b/doc/installation.md index 9e45c9ab..987a51ef 100644 --- a/doc/installation.md +++ b/doc/installation.md @@ -71,23 +71,34 @@ waste_collection_schedule: | Parameter | Type | Requirement | Description | |-----|-----|-----|-----| -| sources: | | required | Contains information for the service provider being used | -| name: | string | required | name of the service provider source to use. Should be the same as the source filename, but without the `.py` extension. See the [README](/README.md#supported-service-providers) for supported service providers | -| args: | various | required | source-specific arguments provided to service provider to unambiguously identify the collection schedule to return. Depending on the service provider, some arguments may be mandatory, and some may be optional. See individual sources for more details | -| customize: | | optional | Can be used to customise data retrieved from a source | -| type: | string | required | The identity of the waste type as returned from the source | -| alias: | string | optional | A more readable, or user-friendly, name for the type of waste being collected. Default is `None` | -| show: | boolean | optional | Show (`True`) or hide (`False`) collections of this specific waste type. Default is `True` | -| icon: | string | optional | Icon to use for this specific waste type. Icons from the Home Assistant mdi icon set can be used. Default is `None`. | -| picture: | string | optional | string representation of the path to a picture used to represent this specific waste type. Default is `None` | -| use_dedicated_calendar: | boolean | optional | Creates a calendar dedicated to this specific waste type. Default is `False` | -| dedicated_calendar_title: | string | optional | A more readable, or user-friendly, name for this specific waste calendar object. If nothing is provided, the name returned by the source will be used | -| fetch_time: | time | optional | representation of the time of day in "HH:MM" that Home Assistant polls service provider for latest collection schedule. If no time is provided, the default of "01:00" is used | -| random_fetch_time_offset: | int | optional | randomly offsets the `fetch_time` by up to _int_ minutes. Can be used to distribute Home Assistant fetch commands over a longer time frame to avoid peak loads at service providers | -| day_switch_time: | time | optional | time of the day in "HH:MM" that Home Assistant dismisses the current entry and moves to the next entry. If no time if provided, the default of "10:00" is used. | -| separator: | string | optional | Used to join entries if the multiple values for a single day are returned by the source. If no value is entered, the default of ", " is used | +| sources | list | required | Contains information for the service provider being used. For details see [Attributes for sources](#attributes-for-sources) | +| fetch_time | time | optional | representation of the time of day in "HH:MM" that Home Assistant polls service provider for latest collection schedule. If no time is provided, the default of "01:00" is used | +| random_fetch_time_offset | int | optional | randomly offsets the `fetch_time` by up to _int_ minutes. Can be used to distribute Home Assistant fetch commands over a longer time frame to avoid peak loads at service providers | +| day_switch_time | time | optional | time of the day in "HH:MM" that Home Assistant dismisses the current entry and moves to the next entry. If no time if provided, the default of "10:00" is used. | +| separator | string | optional | Used to join entries if the multiple values for a single day are returned by the source. If no value is entered, the default of ", " is used | -## Configuring source sensor(s) +## Attributes for _sources_ + +| Parameter | Type | Requirement | Description | +|-----|-----|-----|-----| +| name | string | required | name of the service provider source to use. Should be the same as the source filename, but without the `.py` extension. See the [README](/README.md#supported-service-providers) for supported service providers | +| args | various | required | source-specific arguments provided to service provider to unambiguously identify the collection schedule to return. Depending on the service provider, some arguments may be mandatory, and some may be optional. See individual sources for more details | +| customize | list | optional | Can be used to customise data retrieved from a source. For details see [Attributes for customize](#attributes-for-customize) | +| use_dedicated_calendar | boolean | optional | Creates a calendar dedicated to this specific waste type. Default is `False` | +| dedicated_calendar_title | string | optional | A more readable, or user-friendly, name for this specific waste calendar object. If nothing is provided, the name returned by the source will be used | + + +## Attributes for _customize_ + +| Parameter | Type | Requirement | Description | +|-----|-----|-----|-----| +| type | string | required | The identity of the waste type as returned from the source | +| alias | string | optional | A more readable, or user-friendly, name for the type of waste being collected. Default is `None` | +| show | boolean | optional | Show (`True`) or hide (`False`) collections of this specific waste type. Default is `True` | +| icon | string | optional | Icon to use for this specific waste type. Icons from the Home Assistant mdi icon set can be used. Default is `None`. | +| picture | string | optional | string representation of the path to a picture used to represent this specific waste type. Default is `None` | + +## Configuring Sensor(s) Add the following lines to your `configuration.yaml` file: