mampfes / hacs_waste_collection_schedule

Home Assistant integration framework for (garbage collection) schedules
MIT License
971 stars 628 forks source link

Shows wrong year (2023) #1575

Closed daloki83 closed 8 months ago

daloki83 commented 8 months ago

I Have A Problem With:

The integration in general

What's Your Problem

I just added the new calendar for 2024 and placed it localy like in the past. For some reason is shows the upcoming events for 2023 not for 2024 ics File: abfallkalender.ics.zip

Bildschirmfoto vom 2023-12-27 09-42-36

I already redownloaded WCS and switched to Master branch but no changes :-(

Maybe its because the entities does not contain a year? Bildschirmfoto vom 2023-12-27 09-44-17

Home Assistant Calendar tab - is fine. Everything in 2024

Source (if relevant)

local .ics file

Logs

n/a

Relevant Configuration

waste_collection_schedule:
  sources:
    - name: ics
      args:
        file: "www/abfallkalender.ics"
      customize:
        - type: "Papier - Hauptstraße (Altenmittlau) - Freigericht"
          alias: Papiertonne
          picture: http://192.168.178.72:8123/local/Blauetonne.png
        - type: "Gelbe Tonne - Hauptstraße (Altenmittlau) - Freigericht"
          alias: GelberSack
          picture: http://192.168.178.72:8123/local/Gelbetonne.png
        - type: "Restmüll - Hauptstraße (Altenmittlau) - Freigericht"
          alias: Restmuell
          picture: http://192.168.178.72:8123/local/Schwarzetonne.png
  fetch_time: "04:00"
  day_switch_time: "12:00"

Checklist Source Error

Checklist Sensor Error

Required

5ila5 commented 8 months ago

I will have a look later but:

you should be able to use this btw. So you do not need to update your local ics file.

waste_collection_schedule:
  sources:
    - name: jumomind_de
      args:
        service_id: mkk
        city: Freigericht
        street: Hauptstraße (Altenmittlau)
daloki83 commented 8 months ago

thanks for your fast answer...it seems with jumomind_de its working in the calendar view...however i didn't get it to display as before on my dashboard so i switched back to .ics.....will try it later again.

A fix would be also nice :-)

5ila5 commented 8 months ago

could you provide your sensor/card configuration as I have trouble reproducing this behaviour?

daloki83 commented 8 months ago

Sorry for late reply. Meanwhile I got the online version running incl.cards etc. But I will check my backups so i can provide you the code later

daloki83 commented 8 months ago

Finally i could extract it from the backup....attached the old (.ics) version with the "2023" error and the new with online calendar ics2023.zip

5ila5 commented 8 months ago

you reported bug is not a bug of this integration you defined the sensors date_template to be weekday, day.month your Markdown-Kartenkonfiguration.yaml then gets the date(without year) from theses sensors:

{% set date_pattern = '\w{3}, (\d{2}.\d{2}.)' %}{% set date_matches = states.sensor.abfallgelbersack.attributes | regex_findall(date_pattern) %}{% if date_matches %}{% set date_string = date_matches[0] %}

and the current year (now().strftime("%Y")) and appends this year to the date

{% set year = now().strftime("%Y") %}{% set formatted_date = date_string ~ year %}{{ formatted_date }}

So this integration does not provide the year in your configuration but your Markdown-Kartenkonfiguration.yaml just use the current year

whole template:

{% set date_pattern = '\w{3}, (\d{2}.\d{2}.)' %}{% set date_matches = states.sensor.abfallgelbersack.attributes | regex_findall(date_pattern) %}{% if date_matches %}{% set date_string = date_matches[0] %}{% set year = now().strftime("%Y") %}{% set formatted_date = date_string ~ year %}{{ formatted_date }}{% else %}Kein gültiges Datum gefunden.{% endif %}