mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 00:04:11 +01:00
new .md files added
This commit is contained in:
218
doc/contributing.md
Normal file
218
doc/contributing.md
Normal file
@@ -0,0 +1,218 @@
|
||||
<img src="/images/icon.png" alt="Waste Collection Schedule logo" title="Waste Collection Schedule" align="right" height="60" />
|
||||
|
||||
# Contributing To Waste Collection Schedule
|
||||

|
||||

|
||||

|
||||
|
||||
There are several ways of contributing to this project, including:
|
||||
- Providing new service providers
|
||||
- Updating or improving the documentation
|
||||
- Helping answer/fix any issues raised
|
||||
- Join in with the Home Assistant Community discussion
|
||||
|
||||
## Adding New Service Providers
|
||||
|
||||
### Fork And Clone The Repository, And Checkout A New Branch
|
||||
In GitHub, navigate to the repository [homepage](https://github.com/mampfes/hacs_waste_collection_schedule). Click the `fork` button at the top-right side of the page to fork the repository.
|
||||
|
||||

|
||||
|
||||
Navigate to your fork's homepage, click the `code` button and copy the url.
|
||||
|
||||

|
||||
|
||||
On your local machine, open a terminal and navigate to the location where you want the cloned directory. Type `git clone` and paste in the url copied earlier. It should look something like this, but with your username replacing `YOUR-GITHUB-USERNAME`:
|
||||
```bash
|
||||
git clone https://github.com/YOUR-GITHUB-USERNAME/hacs_waste_collection_schedule
|
||||
```
|
||||
|
||||
Before making any changes, create a new branch to work on.
|
||||
```bash
|
||||
git branch <new_branch_name>
|
||||
```
|
||||
For example, if you were adding a new provider called abc.com, you could do
|
||||
```bash
|
||||
git branch adding_abc_com
|
||||
```
|
||||
|
||||
For more info on forking/cloning a repository, see GitHub's [fork-a-repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo) document.
|
||||
|
||||
### Files Required For A New Service Provider
|
||||
The following files need to be provided to support a new service provider:
|
||||
- A python `source script` that retrieves the collection schedule information, formats it appropriately, and has test cases that can be used to confirm functionality.
|
||||
- A `source markdown (.md)` file that describes how to configure the new source and sensor, with examples.
|
||||
- An updated `README.md` file containing details of the new service provider.
|
||||
- An updated `info.md` file containing details of the new service provider.
|
||||
|
||||
The framework contains a test script that can be used to confirm source scripts are retrieving and returning correctly formatted waste collection schedules.
|
||||
|
||||
### Python Source Script
|
||||
|
||||
Create a new file in the `custom_components/waste_collection_schedule/waste_collection_schedule/source` folder. The file name should be the url of your service provider in lower case, for example `abc_com.py` for `https://www.abc.com`.
|
||||
|
||||
The script should have the following general structure
|
||||
|
||||
```py
|
||||
import datetime
|
||||
from waste_collection_schedule import Collection
|
||||
|
||||
|
||||
DESCRIPTION = "Source script for abc.com" # Describe your source
|
||||
URL = "abc.com" # Insert url to service homepage
|
||||
TEST_CASES = { # Insert arguments for test cases to be used by test_sources.py script
|
||||
"TestName1": {"arg1": 100, "arg2": "street"}
|
||||
"TestName2": {"arg1": 200, "arg2": "road"}
|
||||
"TestName3": {"arg1": 300, "arg2": "lane"}
|
||||
}
|
||||
API_URLS = { # Dict of API end-points if required
|
||||
"address_search": "https://abc.com/search/",
|
||||
"collection": "https://abc.com/search/{}/",
|
||||
}
|
||||
ICONS = { # Dict of waste types and suitable mdi icons
|
||||
"DOMESTIC": "mdi:trash-can",
|
||||
"RECYCLE": "mdi:recycle",
|
||||
"ORGANIC": "mdi:leaf",
|
||||
}
|
||||
|
||||
|
||||
class Source:
|
||||
def __init__(self, arg1, arg2): # argX correspond to the args dict in the source configuration
|
||||
self._arg1 = arg1
|
||||
self._arg2 = arg2
|
||||
|
||||
def fetch(self):
|
||||
|
||||
# replace this comment with
|
||||
# api calls or web scraping required
|
||||
# to capture waste collection schedules
|
||||
# and extract date and waste type details
|
||||
|
||||
entries = [] # List that holds collection schedule
|
||||
|
||||
entries.append(
|
||||
Collection(
|
||||
date = datetime.datetime(2020, 4, 11), # Collection date
|
||||
t = "Waste Type", # Collection type
|
||||
icon = ICONS.get("Waste Type"), # Collection icon
|
||||
)
|
||||
)
|
||||
|
||||
return entries
|
||||
```
|
||||
Filtering of data for waste types or time periods is a functionality of the framework and should not be done by the source script. Therefore:
|
||||
- A source script should return all data for all available waste types.
|
||||
- A source script should **not** provide options to limit the returned waste types.
|
||||
- A source script should return all data for the entire time period available (including past dates if they are returned).
|
||||
- A source script should **not** provide a configuration option to limit the requested time frame.
|
||||
|
||||
|
||||
### Service Provider Markdown File
|
||||
Create a new markdown file in the `custom_components/waste_collection_schedule/doc/source` folder. The file name should be the url of your service provider in lower case, for example `abc_com.md` for `https://www.abc.com`.
|
||||
|
||||
The markdown file should have the following general structure:
|
||||
|
||||
1. A description of how the source should be configured.
|
||||
2. A description of the arguments required, the type, and whether they are optional/mandatory.
|
||||
3. A working example (usually one of the test cases from the `.py` file)
|
||||
|
||||
For example:
|
||||
|
||||
**Configuration via configuration.yaml**
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: abc_com
|
||||
args:
|
||||
uprn: UNIQUE_PROPERTY_REFERENCE_NUMBER
|
||||
```
|
||||
|
||||
**Configuration Variables**
|
||||
|
||||
**uprn** _(string) (required)_ : The unique 12-digit identifier for your property
|
||||
|
||||
**Example**
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: abc_com
|
||||
args:
|
||||
uprn: "e3850cac2d5b"
|
||||
```
|
||||
Note: Your uprn can be found on invoices from your service provider
|
||||
|
||||
|
||||
### Updated README File
|
||||
The README.md file in the top level folder contains a list of supported service providers. Please add your new entry to the relevant country section, creating a new section if yours is the first provider for that country. The entry should contain the name of the service provider and a link to the service providers markdown file. For example:
|
||||
```markdown
|
||||
- [Abfall.IO / AbfallPlus.de](/doc/source/abfall_io.md)
|
||||
```
|
||||
|
||||
### Updated info.md File
|
||||
The `info.md` is rendered in the HACS user interface within Home Assistant and gives potential users a summary of what the component does, and the service providers supported. Please add your new service provider to the appropriate country listed in the table. If yours is the first service provider for a country, create a new table row.
|
||||
|
||||
### Test The New Source File
|
||||
Debugging a source script within Home Assistant is not recommended. Home Assistant's start-up process is too slow for fast debugging cycles. To help with debugging/troubleshooting, the Waste Collection Schedule framework contains a command line script that can be used to test source scripts. The script iterates through the `test cases` defined in the source script passing each set of arguments to the source script and prints the results.
|
||||
|
||||
The script supports the following options:
|
||||
|
||||
| Option | Argument | Description |
|
||||
|--------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `-s` | SOURCE | [Source name](https://github.com/mampfes/hacs_waste_collection_schedule#source-configuration-variables) (source file name without ending `.py`) |
|
||||
| `-l` | - | List all found dates |
|
||||
| `-i` | - | Add icon name to output. Only effective together with `-l`. |
|
||||
|
||||
For debugging purposes of a single source, it is recommended to use the `-s SOURCE` option. If used without any arguments provided, the script tests every script in the `custom_components/waste_collection_schedule/waste_collection_schedule/source` folder and prints the number of found entries for every test case.
|
||||
|
||||
To use it:
|
||||
1. Navigate to the `custom_components/waste_collection_schedule/waste_collection_schedule/test/` directory
|
||||
2. Confirm the `test_sources.py` script is present
|
||||
3. Execute the test script. For example, testing the abfall_io.py source script would be:
|
||||
```bash
|
||||
test_sources.py -s abfall_io
|
||||
```
|
||||
4. Confirm the results returned match expectation. For example, testing abfall_io returns:
|
||||
```text
|
||||
Testing source abfall_io ...
|
||||
found 285 entries for Waldenbuch
|
||||
found 58 entries for Landshut
|
||||
found 109 entries for Schoenmackers
|
||||
found 3 entries for Freudenstadt
|
||||
found 211 entries for Ludwigshafen am Rhein
|
||||
found 119 entries for Traunstein
|
||||
found 287 entries for Thalheim
|
||||
```
|
||||
5. To view individual date entries and assigned icons, use the `-i -l` arguments, for example:
|
||||
```bash
|
||||
test_sources.py -s richmondshire_gov_uk -i -l
|
||||
Testing source richmondshire_gov_uk ...
|
||||
found 53 entries for test 1
|
||||
2023-01-02: 240L GREY RUBBISH BIN [mdi:trash-can]
|
||||
2023-01-07: 55L RECYCLING BOX [mdi:recycle]
|
||||
2023-01-13: 240L GREY RUBBISH BIN [mdi:trash-can]
|
||||
2023-01-20: 55L RECYCLING BOX [mdi:recycle]
|
||||
2023-01-27: 240L GREY RUBBISH BIN [mdi:trash-can]
|
||||
...
|
||||
2023-12-01: 240L GREY RUBBISH BIN [mdi:trash-can]
|
||||
2023-12-08: 55L RECYCLING BOX [mdi:recycle]
|
||||
2023-12-15: 240L GREY RUBBISH BIN [mdi:trash-can]
|
||||
```
|
||||
|
||||
### Sync Branch and Create A Pull Request
|
||||
Having completed your changes, sync your local branch to your GitHub repo, and then create a pull request. When creating a pull request, please provide a meaningful description of what the pull request covers. Ideally it should cite the service provider, confirm the .py, .md, README and info.md files have all been updated, and the output of the test_sources.py script demonstrating functionality. Once submitted a number of automated tests are run against the updated files to confirm they can be merged into the master branch. Note: Pull requests from first time contributors also undergo a manual code review before a merge confirmation in indicated.
|
||||
|
||||
Once a pull request has been merged into the master branch, you'll receive a confirmation message. At that point you can delete your branch if you wish.
|
||||
|
||||
## Update Or Improve The Documentation
|
||||
Non-code contributions are welcome. If you find typos, spelling mistakes, or think there are other ways to improve the documentation please submit a pull request with updated text. Sometimes a picture paints a thousand words, so if a screenshots would better explain something, those are also welcome.
|
||||
|
||||
## Help Answer/Fix Issues Raised
|
||||

|
||||
|
||||
Open-source projects are always a work in progress, and [issues](https://github.com/mampfes/hacs_waste_collection_schedule/issues) arise from time-to-time. If you come across a new issue, please raise it. If you have a solution to an open issue, please raise a pull request with your solution.
|
||||
|
||||
## Join The Home Assistant Community Discussion
|
||||

|
||||
|
||||
|
||||
The main discussion thread on Home Assistant's Community forum can be found [here](https://community.home-assistant.io/t/waste-collection-schedule-framework/186492).
|
||||
281
doc/faq.md
Normal file
281
doc/faq.md
Normal file
@@ -0,0 +1,281 @@
|
||||
<!--
|
||||
HIDDEN COMMENT
|
||||
To display a concise document, the FAQ shows a summary of the questions and allows answers to be expanded/collapsed.
|
||||
This is implemented using the following markup:
|
||||
|
||||
<details>
|
||||
<summary>QUESTION TEXT GOES HERE</summary>
|
||||
<p>
|
||||
|
||||
ANSWER GOES HERE - USED STANDARD MARKDOWN
|
||||
</p>
|
||||
</details>
|
||||
|
||||
The empty line after the <p> is intentional and is required for the expand/collapse to function correctly.
|
||||
-->
|
||||
|
||||
|
||||
<img src="/images/icon.png" alt="Waste Collection Schedule logo" title="Waste Collection Schedule" align="right" height="60" />
|
||||
|
||||
# Frequently Asked Questions, or "How Do I ...?"
|
||||
|
||||
<details>
|
||||
<summary>How do I format dates?</summary>
|
||||
<p>
|
||||
|
||||
Use [strftime](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior) in `value_template` or `date_template`:
|
||||
|
||||
```yaml
|
||||
# returns "20.03.2020"
|
||||
value_template: '{{value.date.strftime("%d.%m.%Y")}}'
|
||||
date_template: '{{value.date.strftime("%d.%m.%Y")}}'
|
||||
|
||||
# returns "03/20/2020"
|
||||
value_template: '{{value.date.strftime("%m/%d/%Y")}}'
|
||||
date_template: '{{value.date.strftime("%m/%d/%Y")}}'
|
||||
|
||||
# returns "Fri, 03/20/2020"
|
||||
value_template: '{{value.date.strftime("%a, %m/%d/%Y")}}'
|
||||
date_template: '{{value.date.strftime("%a, %m/%d/%Y")}}'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I show the number of days to the next collection?</summary>
|
||||
<p>
|
||||
|
||||
Set `value_template` within the sensor configuration:
|
||||
|
||||
```yaml
|
||||
value_template: 'in {{value.daysTo}} days'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I show Today / Tomorrow instead of in 0 / 1 days?</summary>
|
||||
<p>
|
||||
|
||||
Set `value_template` within the sensor configuration:
|
||||
|
||||
```yaml
|
||||
# returns "Today" if value.daysTo == 0
|
||||
# returns "Tomorrow" if value.daysTo == 1
|
||||
# returns "in X days" if value.daysTo > 1
|
||||
value_template: '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}in {{value.daysTo}} days{% endif %}'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I join waste types in a value_template?</summary>
|
||||
<p>
|
||||
|
||||
Use the `join` filter:
|
||||
|
||||
```yaml
|
||||
# returns "Garbage, Recycle"
|
||||
value_template: '{{value.types|join(", ")}}'
|
||||
|
||||
# returns "Garbage+Recycle"
|
||||
value_template: '{{value.types|join("+")}}'
|
||||
```
|
||||
|
||||
Note: If you don't specify a `value_template`, waste types will be joined using the `separator` configuration variable.
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I setup a sensor which shows only the days to the next collection?</summary>
|
||||
<p>
|
||||
|
||||
Set `value_template` within the sensor configuration:
|
||||
|
||||
```yaml
|
||||
value_template: '{{value.daysTo}}'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I setup a sensor which shows only the date of the next collection?</summary>
|
||||
<p>
|
||||
|
||||
Set `value_template` within the sensor configuration:
|
||||
|
||||
```yaml
|
||||
value_template: '{{value.date.strftime("%m/%d/%Y")}}'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I configure a sensor which shows only the waste type of the next collection?</summary>
|
||||
<p>
|
||||
|
||||
Set `value_template` within the sensor configuration:
|
||||
|
||||
```yaml
|
||||
value_template: '{{value.types|join(", ")}}'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I configure a sensor to show only collections of a specific waste type?
|
||||
</summary>
|
||||
<p>
|
||||
|
||||
Set `types` within the sensor configuration:
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
- platform: waste_collection_schedule
|
||||
name: next_garbage_collection
|
||||
types:
|
||||
- Garbage
|
||||
|
||||
- platform: waste_collection_schedule
|
||||
name: next_recycle_collection
|
||||
types:
|
||||
- Recycle
|
||||
```
|
||||
|
||||
Note: If you have set an alias for a waste type, you must use the alias name.
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How can I rename an waste type?</summary>
|
||||
<p>
|
||||
|
||||
Set `alias` in the customize section of a source:
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: NAME
|
||||
customize:
|
||||
- type: Very long garbage name
|
||||
alias: Garbage
|
||||
- type: Very long recycle name
|
||||
alias: Recycle
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How can I hide a waste type I don't want to see?</summary>
|
||||
<p>
|
||||
|
||||
Set `show` configuration variable to *false* in the customize section of a source:
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: NAME
|
||||
customize:
|
||||
- type: Unwanted Waste Type
|
||||
show: false
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How do I show a coloured Lovelace card depending on the due date?</summary>
|
||||
<p>
|
||||
|
||||
You can use [Button Card](https://github.com/custom-cards/button-card) to create a coloured Lovelace cards:
|
||||
|
||||

|
||||
|
||||
```yaml
|
||||
# configuration.yaml
|
||||
sensor:
|
||||
- platform: waste_collection_schedule
|
||||
name: MyButtonCardSensor
|
||||
value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%a")}}'
|
||||
```
|
||||
|
||||
```yaml
|
||||
# button-card configuration
|
||||
type: 'custom:button-card'
|
||||
entity: sensor.mybuttoncardsensor
|
||||
layout: icon_name_state2nd
|
||||
show_label: true
|
||||
label: |
|
||||
[[[
|
||||
var days_to = entity.state.split("|")[1]
|
||||
if (days_to == 0)
|
||||
{ return "Today" }
|
||||
else if (days_to == 1)
|
||||
{ return "Tomorrow" }
|
||||
else
|
||||
{ return "in " + days_to + " days" }
|
||||
]]]
|
||||
show_name: true
|
||||
name: |
|
||||
[[[
|
||||
return entity.state.split("|")[0]
|
||||
]]]
|
||||
state:
|
||||
- color: red
|
||||
operator: template
|
||||
value: '[[[ return entity.state.split("|")[1] == 0 ]]]'
|
||||
- color: orange
|
||||
operator: template
|
||||
value: '[[[ return entity.state.split("|")[1] == 1 ]]]'
|
||||
- value: default
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Can I also use the Garbage Collection Card instead?</summary>
|
||||
<p>
|
||||
|
||||
Yes, the [Garbage Collection Card](https://github.com/amaximus/garbage-collection-card) can also be used with *Waste Collection Schedule*:
|
||||
|
||||
```yaml
|
||||
# configuration.yaml
|
||||
sensor:
|
||||
- platform: waste_collection_schedule
|
||||
name: garbage_days
|
||||
details_format: appointment_types
|
||||
value_template: "{{ value.daysTo }}"
|
||||
types:
|
||||
- Garbage
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
garbage:
|
||||
value_template: >
|
||||
{% if states('sensor.garbage_days')|int > 2 %}
|
||||
2
|
||||
{% else %}
|
||||
{{ states('sensor.garbage_days')|int }}
|
||||
{% endif %}
|
||||
attribute_templates:
|
||||
next_date: "{{ state_attr('sensor.garbage_days', 'Garbage') }}"
|
||||
days: "{{ states('sensor.garbage_days')|int }}"
|
||||
```
|
||||
|
||||
```yaml
|
||||
# garbage-collection-card configuration
|
||||
entity: sensor.garbage
|
||||
type: 'custom:garbage-collection-card'
|
||||
```
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>How can I sort waste type specific entities?</summary>
|
||||
<p>
|
||||
|
||||
Prerequisites: You already have dedicated sensors per waste type and want to show the sensor with the next collection in a Lovelace card.
|
||||
|
||||
Add `add_days_to: True` to the configuration of all sensors you want to sort. This will add the attribute `daysTo` which can be used by e.g. [auto-entities](https://github.com/thomasloven/lovelace-auto-entities) to sort entities by day of next collection.
|
||||
</p>
|
||||
</details>
|
||||
|
||||
141
doc/installation.md
Normal file
141
doc/installation.md
Normal file
@@ -0,0 +1,141 @@
|
||||
<img src="/images/icon.png" alt="Waste Collection Schedule logo" title="Waste Collection Schedule" align="right" height="60" />
|
||||
|
||||
# Installation
|
||||
|
||||
## Automated Installation Using HACS
|
||||

|
||||

|
||||
|
||||
The `Waste Collection Schedule` component can be installed via [HACS](https://hacs.xyz/). This allows you to be notified of any updates or new releases of the component.
|
||||
|
||||
After installing HACS:
|
||||
1. Visit the HACS `Integrations` panel in Home Assistant.
|
||||
2. Click `Explore & Download Repositories`.
|
||||
3. Search for `Waste Collection Schedule`.
|
||||
4. Click on the `Waste Collection Schedule` entry.
|
||||
5. Click on `Download` to copy the relevant files to your `config/custom_components/` directory.
|
||||
6. [Configure your waste collection source(s)](#configuring-waste-collection-schedules).
|
||||
7. [Configure your waste collection sensor(s)](#configuring-waste-collection-schedules).
|
||||
8. Restart Home Assistant.
|
||||
|
||||
## Manual Installation
|
||||
|
||||
1. Navigate to the [waste_collection_schedule](https://github.com/mampfes/hacs_waste_collection_schedule/tree/master/custom_components) directory.
|
||||
2. Copy the `waste_collection_schedule` folder (including all files and subdirectories) to your Home Assistant `config/custom_components/` directory.
|
||||
3. [Configure your waste collection source(s)](#configuring-waste-collection-schedules).
|
||||
4. [Configure your waste collection sensor(s)](#configuring-waste-collection-schedules).
|
||||
5. Restart Home Assistant.
|
||||
|
||||
# Configuring Waste Collection Schedules
|
||||
|
||||
To use Waste Collection Schedules, additional entries need to be made in your `configuration.yaml` file. The required entries are:
|
||||
|
||||
1. Configuring source(s)
|
||||
|
||||
For each service provider, a source has to be added to the configuration. The source takes care of the arguments required to get the correct information from the service provider's web page, e.g. district, city, street, house number, etc.
|
||||
|
||||
If you have to fetch data from multiple service providers, you have to add multiple sources. You can also add the same service provider multiple times. This only makes sense if you use it with different arguments, e.g. you are looking to display waste collection schedules for multiple districts served by the same provider.
|
||||
|
||||
2. Configuring sensor(s)
|
||||
|
||||
Sensors are used to visualize the retrieved information, e.g. waste type, next collection date, or number of days to next collection. The sensor state (which can be shown in a Lovelace/Mushroom cards) can be customized using templates. For example, you can display the collection type only, or the next collection date, or a combination of all available information.
|
||||
|
||||
You can also add multiple sensors per source if you are going to display the information in separate entities. For example, if you want each waste type to have its own entity, you can add one sensor per collection type.
|
||||
|
||||
## Configuring Source(s)
|
||||
|
||||
```yaml
|
||||
waste_collection_schedule:
|
||||
sources:
|
||||
- name: SOURCE
|
||||
args:
|
||||
arg1: ARG1
|
||||
arg2: ARG2
|
||||
arg3: ARG3
|
||||
customize:
|
||||
- type: TYPE
|
||||
alias: ALIAS
|
||||
show: SHOW
|
||||
icon: ICON
|
||||
picture: PICTURE
|
||||
use_dedicated_calendar: USE_DEDICATED_CALENDAR
|
||||
dedicated_calendar_title: DEDICATED_CALENDAR_TITLE
|
||||
calendar_title: CALENDAR_TITLE
|
||||
fetch_time: FETCH_TIME
|
||||
random_fetch_time_offset: RANDOM_FETCH_TIME_OFFSET
|
||||
day_switch_time: DAY_SWITCH_TIME
|
||||
separator: SEPARATOR
|
||||
```
|
||||
|
||||
|
||||
| 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 |
|
||||
|
||||
## Configuring source sensor(s)
|
||||
|
||||
Add the following lines to your `configuration.yaml` file:
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
- platform: waste_collection_schedule
|
||||
source_index: SOURCE_INDEX
|
||||
name: NAME
|
||||
details_format: DETAILS_FORMAT
|
||||
count: COUNT
|
||||
leadtime: LEADTIME
|
||||
value_template: VALUE_TEMPLATE
|
||||
date_template: DATE_TEMPLATE
|
||||
add_days_to: ADD_DAYS_TO
|
||||
types:
|
||||
- Waste Type 1
|
||||
- Waste Type 2
|
||||
```
|
||||
| Parameter | Type | Requirement | Description |
|
||||
|--|--|--|--|
|
||||
| platform | | required | waste_collection_schedule |
|
||||
| source_index | int | optional | Used to assign a sensor to a specific source. Only needed if multiple sources are defined. The first source defined is source_index 0, the second source_index 1, etc. If no value is supplied, the default of 0 is used |
|
||||
| name | string | required | The name Home Assistant used for this sensor |
|
||||
| details_format | string | optional | Specifies the format used to display info in Home Assistant's _more info_ pop-up. Valid values are: `"upcoming"`, `"appointment_types"` and `"generic"`. If no value is supplied, the default of "upcoming" is used. See [options for details_format](#options-for-details_format-parameter) for more details |
|
||||
| count | int | optional | Limits Home Assistant's _more info_ popup to displaying the next _int_ collections |
|
||||
| leadtime | int | optional | Limits Home Assistant's _more info_ popup to only displaying collections happening within the next _leadtime_ days|
|
||||
| value_template | string | optional | Uses Home Assistant templating to format the state information of an entity. See [template variables](#template-variables-for-value_template-and-date_template-parameters) for further details |
|
||||
| date_template | string | optional | Uses Home Assistant templating to format the dates appearing within the _more info_ popup information of an entity. See [template variables](#template-variables-for-value_template-and-date_template-parameters) for further details |
|
||||
| add_days_to | boolean | optional | Adds a `daysTo` attribute to the source entity state containing the number of days to the next collection |
|
||||
| types | list of strings | optional | Used to filter waste types. The sensor will only display collections matching these waste types |
|
||||
|
||||
## Options for _details_format_ parameter ##
|
||||
Possible choices:
|
||||
| upcoming | appointment_types | generic |
|
||||
|--|--|--|
|
||||
| shows a list of upcoming collections |shows a list of waste types and their next collection date | provides all attributes as generic Python data types. |
|
||||
|  |  |  |
|
||||
|
||||
## Template variables for _value_template_ and _date_template_ parameters
|
||||
|
||||
The following variables can be used within `value_template` and `date_template`:
|
||||
|
||||
| Variable | Description | Type |Comments |
|
||||
|--|--|--|--|
|
||||
| `value.date` | Collection date | [datetime.date](https://docs.python.org/3/library/datetime.html#datetime.date) | Use [strftime](https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior) to format the output |
|
||||
| `value.daysTo` | Days to collection | int | 0 = today, 1 = tomorrow, etc |
|
||||
| `value.types` | Waste types | list of strings | Use `join` filter to join types |
|
||||
|
||||
## Further help ##
|
||||
For a full example, see [custom_components/waste_collection_schedule/waste_collection_schedule/source/example.py](/custom_components/waste_collection_schedule/waste_collection_schedule/source/example.py).
|
||||
|
||||
For other examples on how to configure source(s) and sensor(s), see the [FAQ](/doc/faq.md).
|
||||
23
doc/licence.md
Normal file
23
doc/licence.md
Normal file
@@ -0,0 +1,23 @@
|
||||
<img src="/images/icon.png" alt="Waste Collection Schedule logo" title="Waste Collection Schedule" align="right" height="60" />
|
||||
|
||||
# MIT License
|
||||
|
||||
Copyright (c) 2020 Steffen Zimmermann
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
24
doc/online.md
Normal file
24
doc/online.md
Normal file
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
Github Markdown reference: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github
|
||||
-->
|
||||
|
||||
<!-- place the logo top-right of the page-->
|
||||
<img src="/images/icon.png" alt="Waste Collection Schedule logo" title="Waste Collection Schedule" align="right" height="60" />
|
||||
|
||||
<!-- The main page heading -->
|
||||
# Waste Collection Schedule Online
|
||||
|
||||
<!-- The page content -->
|
||||
## Community Forum
|
||||

|
||||
|
||||
The main discussion thread on Home Assistant's Community forum can be found [here](https://community.home-assistant.io/t/waste-collection-schedule-framework/186492).
|
||||
|
||||
|
||||
## YouTube
|
||||
There are some videos on YouTube:
|
||||
|
||||
- [Bunte Mülltonnenerinnerung mit Home Assistant](https://youtu.be/MzQgARDvRww) (German language)
|
||||
- [Abfall Kalender in Home Assistant mit Erinnerung in Home Assistant](https://youtu.be/aCKLKGYiA7w) (German language)
|
||||
|
||||
Note: These videos were **not** created by the developer of this component and therefore may be outdated. If you have questions about this component, please create an issue here on GitHub. Do not ask your question in the YouTube comments because any answers may not be correct.
|
||||
24
doc/page_template.md
Normal file
24
doc/page_template.md
Normal file
@@ -0,0 +1,24 @@
|
||||
<!--
|
||||
Github Markdown reference: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github
|
||||
-->
|
||||
|
||||
<!-- place the logo top-right of the page-->
|
||||
<img src="/images/icon.png" alt="Waste Collection Schedule logo" title="Waste Collection Schedule" align="right" height="60" />
|
||||
|
||||
<!-- The main page heading -->
|
||||
# PAGE TITLE GOES HERE
|
||||
|
||||
<!-- The page content -->
|
||||
Asperiores et ratione similique sapiente impedit fuga. Ullam nihil cupiditate ut aliquam non dolorem qui. Rerum ipsa esse amet ipsam omnis et aut laboriosam. Quo dolorem veniam eius doloribus sint aut. Minus placeat quis corporis. Ipsam soluta quidem reprehenderit aspernatur sit sed.
|
||||
|
||||
## SOME SUB-TITLE
|
||||
Repudiandae sequi sint tenetur quia perferendis quod amet nulla. Eum sed id quam nobis modi aut nulla libero. Veniam accusantium quia asperiores expedita.
|
||||
|
||||
### A SUB-SUB-TITLE
|
||||
Officiis iure et et et. Recusandae quia hic est in in exercitationem est praesentium. Alias dolores adipisci eum.
|
||||
|
||||
### ANOTHER SUB-SUB-TITLE
|
||||
Velit unde voluptatem quo nisi voluptatum doloribus beatae. Perferendis voluptatem eos ut et quidem culpa. Accusantium consequatur necessitatibus non.
|
||||
|
||||
## AND ANOTHER SUB-TITLE
|
||||
Vitae animi tempora voluptatem doloribus est voluptate qui. Nihil quia numquam voluptates. Aut saepe quia doloribus. Quidem ea non nihil sit cum. Voluptates aperiam quod molestiae non et velit dolorem eos.
|
||||
Reference in New Issue
Block a user