Waste Collection Schedule Framework

My service provider has changed the format of the ics file. Now multiple waste types are combined in one event entry:

BEGIN:VEVENT
UID:20230611T231127UTC-9972G9uEm2
DTSTAMP:20230611T231127Z
DESCRIPTION:Entsorgung: Hausmüllbehälter\, Gelber Sack\, Papierbehälter
DTSTART;TZID=Europe/Berlin:20231121T000000
DTEND;TZID=Europe/Berlin:20231121T005959
LOCATION:xyz
SUMMARY:Hausmüllbehälter\, Gelber Sack\, Papierbehälter
END:VEVENT

I was hoping that I can use the optional Separator parameter in this case:

waste_collection_schedule:
  separator: '\, '
  sources:
    - name: ics

I have tried several different separator variants (with escaping and w/o, also editing a test ics file). None of them worked.

Does anyone have a comparable configuration? How did you solve the problem?

Hi, I need help with my sensors.
I got them working, but it is showing the day and date in English locale (and I want swedish).

I know I have to do something in the code to fix it but I am unsure what to add. It is currently showing for example “Mon den 10.7.2023” and I would like to change that to “Måndag den 10/7” or something similar. How would I go about doing this?

See code below:

sensor:
  - platform: waste_collection_schedule
    name: Sopor
    value_template: '{% if value.daysTo == 0 %}Idag{% elif value.daysTo == 1 %}Imorgon{% elif value.daysTo < 3 %}om {{value.daysTo}} dagar{% else %} {{value.date.strftime("%a")}} den {{value.date.strftime("%d.%m.%Y")}} {% endif %}'
    types:
      - FNI Kärl 1
  - platform: waste_collection_schedule
    name: Återvinning
    value_template: '{% if value.daysTo == 0 %}Idag{% elif value.daysTo == 1 %}Imorgon{% elif value.daysTo < 3 %}om {{value.daysTo}} dagar{% else %} {{value.date.strftime("%a")}} den {{value.date.strftime("%d.%m.%Y")}} {% endif %}'
    types:
      - FNI Kärl 2

Edit:
Solved with this code

sensor:
  - platform: waste_collection_schedule
    name: Sopor
    value_template: >
      {% set weekdays = ["Mån", "Tis", "Ons", "Tor", "Fre", "Lör", "Sön"] %}
      {% if value.daysTo == 0 %}
        Idag
      {% elif value.daysTo == 1 %}
        Imorgon
      {% elif value.daysTo < 3 %}
        om {{ value.daysTo }} dagar
      {% else %}
        {{ weekdays[value.date.weekday()] }} den {{ value.date.strftime("%d.%m.%Y") }}
      {% endif %}
    types:
      - FNI Kärl 1

@EsTeGe

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: your-file-name.ics
        split_at: '\, '
2 Likes

@aichingerk The problem is that you specified neither until nor count. Therefore it defaults to count=10 and for Biomuell and Restmuell the 10 events are already in the past and therefore not shown any more. So please specify either unitl or count - for every static source. If will add a comment in the documentation that makes this clearer.

1 Like

Thx. i made it with count in each static entry and now it is working perfekt :grinning:

See, right place - right answer! :rofl: Honestly, I never would have thought about that. :slight_smile:

I realy like this integration. I’ve moved to a new home and I get my schedules as an ics calendar. The problem is, that all schedules have tailing date eg

BEGIN:VEVENT
UID:64a1477c97932
DTSTART;TZID=Europe/Berlin:20230111T060000
DTEND;TZID=Europe/Berlin:20230111T080000
DTSTAMP:20230702T114636Z
CLASS:PUBLIC
DESCRIPTION:www.entsorgung-sad.de
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Restmüll 11.01.2023
LOCATION:93133 Burglengenfeld Kiebitzweg  
BEGIN:VALARM
TRIGGER:-PT720M
ACTION:DISPLAY
DESCRIPTION:Restmüll
END:VALARM
TRANSP:TRANSPARENT
END:VEVENT
BEGIN:VEVENT

how do i get rid of the tailing date without recreating the whole calendar?

@Per1962 You can remove superfluous text with the regex argument of the ICS source. Let me know if this doesn’t work for you.

Thank you. That helped. Adding

    - name: ics
      args:
        url: "..../basic.ics"
        regex: '^([\w\-]+)'

to the config did the job :slight_smile:

1 Like

You should consider adding your working configuration amongst the others here: hacs_waste_collection_schedule/doc/source/ics.md at 7ea7a22103b76c57bb1fa265edeabde3ee817bbb · mampfes/hacs_waste_collection_schedule · GitHub

Hi,

I need some help with my configuration. I have two ics sources configured (as shown below). All events of both sources are shown in my calender. However only the first source is recognized by my sensors (also below).

I’ve already tried to switch the order of the sources. When I do so, it is still the first source which is working and the second doesn’t.

waste_collection_schedule:
  sources:
    - name: ics
      calendar_title: Restmüll & Wertstoff
      args:
        url: https://waste.awb-landkreis-karlsruhe.de/WasteManagementKarlsruheHaushalteBlank/WasteManagementServiceServlet?ApplicationName=Calendar&SubmitAction=sync&StandortID=**XXXXXX**&AboID=**XXXXX**&Fra=RT;RC1;RC2;WT;WC;Schad;BT2;BT1;BC
      customize: 
        - type: Wertstoffbehaelter
          alias: Wertstoff
          icon: mdi:recycle
        - type: Restabfallbehaelter
          alias: Restmuell
          icon: mdi:trash-can
    - name: ics
      calendar_title: Papier
      args:
        url: https://www.blauetonne-schlauetonne.de/abfuhrkalender/{%Y}/XXXXXXX.ics
      customize: 
        - type: Leerung der Blauen Tonne Schlauen Tonne
          alias: Papier
          icon: mdi:delete-variant
sensor:    
  - platform: waste_collection_schedule
    name: Restmüll
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tagen{% endif %}'
    types:
      - Restmuell

  - platform: waste_collection_schedule
    name: Papier
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tagen{% endif %}'
    types:
      - Papier

  - platform: waste_collection_schedule
    name: Wertstoff
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Heute{% elif value.daysTo == 1 %}Morgen{% else %}in {{value.daysTo}} Tagen{% endif %}'
    types:
      - Wertstoff

  - platform: waste_collection_schedule
    name: RestmüllDatum
    details_format: "upcoming"
    value_template: 'am: {{value.date.strftime("%d.%m.%Y")}}'
    types:
      - Restmuell

  - platform: waste_collection_schedule
    name: WertstoffDatum
    details_format: "upcoming"
    value_template: 'am: {{value.date.strftime("%d.%m.%Y")}}'
    types:
      - Wertstoff
      
  - platform: waste_collection_schedule
    name: PapierDatum
    details_format: "upcoming"
    value_template: 'am: {{value.date.strftime("%d.%m.%Y")}}'
    types:
      - Papier

@MOP You have to set source_index for sensors of the 2nd source:

Ah, thanks you. Havn’t seen this. Works liike a charm :slight_smile:.

Hi,

I am trying to get this to work but the sensor(s) will not show up when i search for them. I have followed the configuration instructions on your Github page. I also tried to set the fetch_time parameter to something nearby but that didn’t help.

I have the following in my “configuration.yaml” (file is located under /configuration/):

waste_collection_schedule:
sources:
    - name: affarsverken_se
      args:
        address: "street 13, city"
  fetch_time: 09:22
sensor:
- platform: waste_collection_schedule
    name: sophamtning
    details_format: appointment_types
    count: 3
    leadtime: 21

Any help on what I’m doing wrong is greatly appreciated!

@velodromen Do you see errors in the HA log?

My apologies, I didn’t see anything related to this integration in my HA logs so I decided to do a full restart of my server. Now all is working as intended…:flushed:

I did actually tried with both a refresh of the yaml-files and a regular restart of HA (though not the entire system) but that would not fire up the integration for some reason.

Nevertheless, Thanks for taking your time here!

First of all, thank you for this integration!

I’m having a difficult time with Republic Services and can’t seem to find a way around it, but perhaps I am missing something.

There are 3 types of pickup, but their API returns 3 data elements with only 2 types: Solid Waste and Recycle and I’m trying to treat that as Solid Waste, Recycle, and Yard Waste.

The API returns a productDescription attribute indicating yard waste and I can see that mapped to “waste_description” in the source, but then it is later dropped and not returned with the entities. The icon is updated to mdi:leaf, but I can not locate where it is exposed so that I can use it.

I’ve tried using an alias, but that doesn’t work, as only the two types of Solid Waste and Recyle are seen.

Does anyone have any idea how I can break this into the three real types for scheduling and display on calendar?

Here’s a sample of the data returned by the API. Note productDescription:

"statusCode": 200,
    "data": {
        "commercial": [],
        "residential": [
            {
                "containerId": "xxxxxxxx",
                "containerType": "CA",
                "containerSize": "0.48",
                "containerStatus": "Open",
                "containerCategory": "Residential",
                "customerOwnedInd": false,
                "productDescription": "TRASH CART 95/96 GAL",
                "onCallInd": false,
                "serviceStartDate": "yyyy-mm-dd",
                "serviceChangeLastDate": "yyyy-mm-dd",
                "quantityOnSite": 1,
                "quantityOrdered": 1,
                "wasteTypeDescription": "Solid Waste",
                "mondayPickups": 0,
                "tuesdayPickups": 0,
                "wednesdayPickups": 0,
                "thursdayPickups": 0,
                "fridayPickups": 1,
                "saturdayPickups": 0,
                "sundayPickups": 0,
                "numberOfPickupsPeriodLength": 1,
                "numberOfPickupsPeriodUnit": "W",
                "numberOfPickupsTotal": 1,
                "poRequiredInd": false,
                "contractGroupNumber": "0",
                "municipalFranchiseContractNumber": "",
                "revenueDistributionCode": "30",
                "sharedId": "",
                "liftsPerCycle": "1 Every  Week",
                "numberOfShares": 0,
                "receiptRequiredInd": false,
                "receiptRequiredDesc": "NO RECEIPT NEEDED",
                "receiptRequiredCode": "N",
                "accountType": "S",
                "disposalCode": "",
                "disposalPriceCode": "",
                "cityAccount": "",
                "infoProContainerId": "",
                "specialHandlingFlag": " ",
                "nextServiceDays": [
                    "2023-08-11"
                ],
                "lawsonDivisionNumber": "",
                "routeDetails": [
                    {
                        "routeNumber": "xxxx",
                        "stopServiceCode": "C",
                        "stopSequenceNumber": "",
                        "rdUUID": "",
                        "serviceCode": "REG",
                        "routeDescription": "RESI TRASH-POD 1",
                        "nextServiceDays": [
                            "2023-08-11"
                        ],
                        "isRouteSuspended": false
                    }
                ],
                "isServiceInterrupt": false
            },
            {
                "containerId": "xxxxxxxx",
                "containerType": "RC",
                "containerSize": "0.32",
                "containerStatus": "Open",
                "containerCategory": "Residential",
                "customerOwnedInd": false,
                "productDescription": "RECYCLE CART 64/65 GAL",
                "onCallInd": false,
                "serviceStartDate": "yyyy-mm-dd",
                "serviceChangeLastDate": "yyyy-mm-dd",
                "quantityOnSite": 1,
                "quantityOrdered": 1,
                "wasteTypeDescription": "Recycle",
                "mondayPickups": 1,
                "tuesdayPickups": 0,
                "wednesdayPickups": 0,
                "thursdayPickups": 0,
                "fridayPickups": 0,
                "saturdayPickups": 0,
                "sundayPickups": 0,
                "numberOfPickupsPeriodLength": 1,
                "numberOfPickupsPeriodUnit": "W",
                "numberOfPickupsTotal": 1,
                "poRequiredInd": false,
                "contractGroupNumber": "0",
                "municipalFranchiseContractNumber": "",
                "revenueDistributionCode": "7A",
                "sharedId": "",
                "liftsPerCycle": "1 Every  Week",
                "numberOfShares": 0,
                "receiptRequiredInd": false,
                "receiptRequiredDesc": "NO RECEIPT NEEDED",
                "receiptRequiredCode": "N",
                "accountType": "S",
                "disposalCode": "",
                "disposalPriceCode": "",
                "cityAccount": "",
                "infoProContainerId": "",
                "specialHandlingFlag": " ",
                "nextServiceDays": [
                    "2023-08-14"
                ],
                "lawsonDivisionNumber": "",
                "routeDetails": [
                    {
                        "routeNumber": "xxxx",
                        "stopServiceCode": "C",
                        "stopSequenceNumber": "",
                        "rdUUID": "",
                        "serviceCode": "REG",
                        "routeDescription": "RESI RECY-POD 2",
                        "nextServiceDays": [
                            "2023-08-14"
                        ],
                        "isRouteSuspended": false
                    }
                ],
                "isServiceInterrupt": false
            },
            {
                "containerId": "xxxxxxxx",
                "containerType": "HY",
                "containerSize": "0.50",
                "containerStatus": "Open",
                "containerCategory": "Residential",
                "customerOwnedInd": false,
                "productDescription": "YARD WASTE CAN/BAG/BUNDLE",
                "onCallInd": false,
                "serviceStartDate": "yyyy-mm-dd",
                "serviceChangeLastDate": "yyyy-mm-dd",
                "quantityOnSite": 1,
                "quantityOrdered": 1,
                "wasteTypeDescription": "Recycle",
                "mondayPickups": 0,
                "tuesdayPickups": 0,
                "wednesdayPickups": 1,
                "thursdayPickups": 0,
                "fridayPickups": 0,
                "saturdayPickups": 0,
                "sundayPickups": 0,
                "numberOfPickupsPeriodLength": 1,
                "numberOfPickupsPeriodUnit": "W",
                "numberOfPickupsTotal": 1,
                "poRequiredInd": false,
                "contractGroupNumber": "0",
                "municipalFranchiseContractNumber": "",
                "revenueDistributionCode": "7Y",
                "sharedId": "",
                "liftsPerCycle": "1 Every  Week",
                "numberOfShares": 0,
                "receiptRequiredInd": false,
                "receiptRequiredDesc": "NO RECEIPT NEEDED",
                "receiptRequiredCode": "N",
                "accountType": "S",
                "disposalCode": "",
                "disposalPriceCode": "",
                "cityAccount": "",
                "infoProContainerId": "",
                "specialHandlingFlag": " ",
                "nextServiceDays": [
                    "2023-08-09"
                ],
                "lawsonDivisionNumber": "",
                "routeDetails": [
                    {
                        "routeNumber": "xxxx",
                        "stopServiceCode": "C",
                        "stopSequenceNumber": "",
                        "rdUUID": "",
                        "serviceCode": "REG",
                        "routeDescription": "YARD WASTE-POD 1",
                        "nextServiceDays": [
                            "2023-08-09"
                        ],
                        "isRouteSuspended": false
                    }
                ],
                "isServiceInterrupt": false
            }
        ],
        "industrial": [],
        "contract": [],
        "isColaAccount": false
    }
}

How can I include more than 1 location within the same service area? I have

# Abfallkalender
waste_collection_schedule:
  sources:
    - name: stadtreinigung_dresden_de
      args:
        standort: 80234

How to add another standort?

You can’t add another standort, but you can add another source (with the same name).
In the sensor section, you have to set source_index to access the data of the 2nd source.

1 Like

I have the same issue with 2 static sources. The sensor for the second source works, but not the first. Both are showing up correctly in Calendar. Hoping someone has some ideas, here’s what I’m running in my YAML:

waste_collection_schedule:
  sources:
    - name: static
      args:
        type: recycling
        frequency: WEEKLY
        interval: 4
        start: "2023-01-09"
        until: "2023-12-31"
      customize:
        - type: recycling
          alias: Recycling
          icon: mdi:recycle
    - name: static
      args:
        type: garbage
        frequency: WEEKLY
        interval: 2
        weekdays: MO
        start: "2023-01-09"
        until: "2023-12-31"
      customize:
        - type: garbage
          alias: Garbage
          icon: mdi:dump-truck

Sensor definition:

  ##############################
  # Waste Collection sensors
  ##############################

  - platform: waste_collection_schedule
    name: next_recycle_collection
    value_template: 'In {{value.daysTo}} days'
    types:
      - Recycling
      
  - platform: waste_collection_schedule
    name: next_trash_collection
    value_template: 'In {{value.daysTo}} days'
    types:
      - Garbage

Thanks!