Files
hacs_waste_collection_schedule/doc/source/ics.md
2021-09-20 20:42:20 +02:00

4.5 KiB

ICS / iCal

Add support for generic ICS / iCal files which are downloaded from a fix location. The waste type will be taken from the summary attribute.

This source has been successfully tested with the following service providers:

Germany

United States of America

Configuration via configuration.yaml

waste_collection_schedule:
  sources:
    - name: ics
      args:
        url: URL
        file: FILE
        offset: OFFSET
        method: METHOD
        params: PARAMS
        year_field: YEAR_FIELD
        split_at: SPLIT_AT

Configuration Variables

url
(string) (optional)

URL to ICS / iCal file. File will be downloaded using a HTTP GET request.

If the original url contains the current year (4 digits including century), this can be replaced by the wildcard {%Y} (see example below).

You have to specify either url or file!

file
(string) (optional)

Local ICS / iCal file name. Can be used instead of url for local files.

You have to specify either url or file!

offset
(int) (optional, default: 0)

Offset in days which will be added to every start time. Can be used if the start time of the events in the ICS file are ahead of the actual date.

method
(string) (optional, default: GET)

Method to send the URL params.

Need to be GET or POST.

params
(dict) (optional, default: None)

Dictionary, list of tuples or bytes to send in the query string for the HTTP GET request. Only used if url is specified, not used for file.

year_field
(string) (optional, default: None)

Field in params dictionary to be replaced with current year (4 digits including century).

split_at
(string) (optional, default: None)

Delimiter to split event summary into individual collection types. If your service puts multiple collections types which occur at the same day into a single event, this option can be used to separate the collection types again.

Examples

waste_collection_schedule:
  sources:
    - name: ics
      args:
        url: "https://www.avl-ludwigsburg.de/fileadmin/Files/Abfallkalender/ICS/Privat/Privat_{%Y}_Ossweil.ics"
        offset: 1
waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "test.ics"
waste_collection_schedule:
  sources:
    - name: ics
      args:
        url: "https://www.abfallkalender-zak.de",
        params:
            city: 2,3,4
            street: 3
            types[]:
              - restmuell
                gelbersack
                papiertonne
                biomuell
                gruenabfall
                schadstoffsammlung
                altpapiersammlung
                schrottsammlung
                weihnachtsbaeume
                elektrosammlung
            go_ics: Download
        },
        year_field: year
waste_collection_schedule:
  sources:
    - name: ics
      args:
        url: "https://www.eaw-rheingau-taunus.de/abfallkalender/calendar.ics?streetid=1429"
        split_at: ","

Recollect.net

To get the URL, search your address in the recollect form of your home town, click "Get a calendar", then "Add to iCal". Finally, the URL under "Subscribe to calendar" is your ICS calendar link:

webcal://recollect.a.ssl.fastly.net/api/places/BCCDF30E-578B-11E4-AD38-5839C200407A/services/208/events.en.ics?client_id=6FBD18FE-167B-11EC-992A-C843A7F05606

Strip the client ID and change the protocol to https, and you have a valid ICS URL.

waste_collection_schedule:
  sources:
    - name: ics
      args:
        url: "https://recollect.a.ssl.fastly.net/api/places/BCCDF30E-578B-11E4-AD38-5839C200407A/services/208/events.en.ics",
        split_at: "\\, [and ]*",