Calendar event dates on dashboard

With the removal of the Garbage Collection custom integration, I’ve been having a hard time figuring out how to mirror what I was doing with it. I’ve seen a number of posts about things similar but nothing that seems to match what I want to do.

With the previous integration I had entities for the different garbage collection events (ie. papers, bottles, garbage) which are now local calendar events. I would use those entities to display when the next occurrence was using Mushroom chips. For example, I had a papers chip that displayed the date of the next pickup, or ‘Tomorrow’ or ‘Today’.

Any idea how I could achieve this now?

Why don’t you use the Waste Collection Schedule integration? It works fine for me.

Thanks for pointing that out, didn’t know it existed. Did you set yours up with an ICS file by any chance? Having trouble getting the sensors set up correctly.

Yes, I use an ICS file.

PS: Please show the setup you have already made.

I basically just have this so far:

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/huntington_garbage_calendar_2023.ics"
- platform: waste_collection_schedule
    name: Garbage
    types:
      - Trash Collection
  - platform: waste_collection_schedule
    name: Bottles
    types:
      - Bottles, Cans & Plastics Recycling
  - platform: waste_collection_schedule
    name: Papers
    types:
      - Paper & Cardboard Recycling

I’m getting some data in the calendar.ics entity that’s being created by the integration but I think the issue is that I’m not getting the summary attribute that seems to be needed for the sensors to pick them up.

It is important, that the types are identical to the description in the ICS-file.

Here is, what I have:

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/abfall.ics"
      customize:
        - type: Restmuell
          alias: restmuell
          icon: mdi:trash-can
        - type: Gelbe Tonne
          alias: gelbetonne
          icon: mdi:trash-can
        - type: Altpapier
          alias: papier
          icon: mdi:recycle
  fetch_time: "04:00"
  day_switch_time: "12:00" 

and this in the -sensor section:

 - platform: waste_collection_schedule
    name: abfallRest
    source_index: 0
    details_format: "upcoming"
    value_template: 'noch {{value.daysTo}} Tage'
    types:
      - restmuell
  - platform: waste_collection_schedule
    name: abfallGelbersack
    details_format: "upcoming"
    value_template: 'noch {{value.daysTo}} Tage'
    types:
      - gelbetonne
  - platform: waste_collection_schedule
    name: abfallPapier
    details_format: "upcoming"
    value_template: 'noch {{value.daysTo}} Tage'
    types:
      - papier
  - platform: waste_collection_schedule
    name: abfallNaechster
    details_format: "upcoming"
    value_template: 'am: {{value.date.strftime("%d.%m.%Y")}}'

if you want to have a sensor with the list of types, for example when you want to send a list to your mobile, you can add:

- platform: waste_collection_schedule
    name: AbfallNotifyTyp
    details_format: "upcoming"
    value_template: '{{value.types}}'

Do the sensors have to be the title or description from the ICS events? The file that my town provides has very long descriptions for each.

Another weird thing I noticed is that in the calendar.ics entity created by the integration shows the next event being this:

Start time
December 26, 2023 at 12:00:00 AM
End time
December 27, 2023 at 12:00:00 AM

Although if I import the ics file into my Google Calendar it shows the proper events for the year.

No, not the sensors. In the first part of my last post under customized: that types must be identical with the description in the ICS.

To change this to your needs (a short description) use the alias under customize. For

- type: Bottles, Cans & Plastics Recycling     # use
  alias: bottlecanplastic

without any spaces.

In the 2. part of my last post in the -sensor section, the name of the sensor can be any word, you like and the -types must be identical to the alias from above.

- platform: waste_collection_schedule
    name: anywordyoulike
    source_index: 0
    details_format: "upcoming"
    value_template: 'in {{value.daysTo}} days'
    types:
      - bottlecanplastic

This creates a sensor named sensor.anywordyoulike

Ya I had tried that based on your setup yesterday and still no luck. Not sure what’s going wrong.

Post, what you have now, please

Source:

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/huntington_garbage_calendar_2023.ics"
      customize:
        - type: Monday Thursday Trash Collection
          alias: garbage
          icon: mdi:trash-can
        - type: Bottles, Cans & Plastics Recycling
          alias: bottles
          icon: mdi:bottle-wine
        - type: Paper & Cardboard Recycling
          alias: papers
          icon: mdi:newspaper-variant
  day_switch_time: "12:00"
  fetch_time: "04:00"

Sensors:

  - platform: waste_collection_schedule
    name: Garbage
    types:
      - garbage
    details_format: "upcoming"
    source_index: 0
  - platform: waste_collection_schedule
    name: Bottles
    types:
      - bottles
    details_format: "upcoming"
    source_index: 0
  - platform: waste_collection_schedule
    name: Papers
    types:
      - papers
    details_format: "upcoming"
    source_index: 0

On first sight: mine has “source_index” only once (with first entry), and the value_template’s are missing.

Tried both with and without the value_template and removed the source_index on everything but the first sensor, but still the same issue.

And what values are in your sensors, if any? Also a look at your ICS file would be usefull.

This is essentially what all the sensors from the integration show:
Screenshot 2023-06-26 074600

And this is what the calendar.ics entity shows:

Can’t upload the ICS directly, but here’s the link to download it:
https://www.huntingtonny.gov/trashcalendar
Click the “Add to calendar” dropdown then “Download ICS”

Thank you, your ICS looks very much different to mine. The best way is to ask @mampfes to add support for your town. Or you take a look on github, how it is handeled for other cities in US: github. I guess your district (TZID=America/New_York:…) has to be selected and some more.

Will do, thanks for all of the help!

I decided to just set up static sources for now. One last question, do you know how I can set up the value_template to show Today, Tomorrow, or MM/DD/YYYY of the next pickup? I tried this but it didn’t seem to work:
'{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}{{value.date.strftime("%m.%d.%Y")}}{% endif %}'

- platform: waste_collection_schedule
    name: anywordyoulike
    source_index: 0
    details_format: "upcoming"
    value_template: '{% if value.daysTo == 0 %}Today{% elif value.daysTo == 1 %}Tomorrow{% else %}{{value.date.strftime("%m.%d.%Y")}}{% endif %}'
    types:
      - bottles

This works only if you use the integration.