German Müllabfuhr sensor (regioIT)

Hi, your ics file is empty … at least when if follow your link.
I guess your key phrase isn’t valid for a long time … have you tried downloading the file and place it into your filesystem. then you can use with e.g. url file:///config/yourfile.ics
kolja

Hi, the error is still there. I have now packed the ICS file into config/www/kalender.

your tool was installed via hacs.

sensor:
  - platform: ics
    name: Abfallkalender
    url: local/kalender/abfall.ics
    id: 1  

and integration in lovelace

entities:
  - entity: sensor.ics_1
title: Abfallkalender
type: entities
show_header_toggle: false
1 Like

hmmm I’m not sure if that can work … can you try:
http://localhost:8123/local/kalender/abfall.ics
Kolja

BTW: there is a new version in HACS that supports config flow, so you don’t have to use YAML and you can test it / set it up without restarts

2 Likes

Thanks, that works now.

You got any advice for me that shows more than just the date. I’d be interested in the kind of household garbage, plastic, or paper and more entries than just the next one.

yes, create multiple sensors and use a different filter (startswith) for each.


Kolja

@karl1986 @Slash If you are interested in automatic daily updates you can also use the Waste Collection Schedule Framework. There is also a wizard which helps to extract the arguments for the source.

Hey, I really do like the addon (I often forget about putting the garbage container on the street). However, it works for me for the Kreis Warendorf, but noch for Coesfeld

Example:
´- platform: abfallapi_regioit
name: muellabfuhr
scan_interval: 3600
anbieter_id: KRWAF
ort: ‘Ahlen’
strasse: ‘Abtstraße’ ´
→ this works just fine

´- platform: abfallapi_regioit
name: muellabfuhr
scan_interval: 3600
anbieter_id: COE
ort: ‘Nottuln’
strasse: 'Burgstraße’´

I get the following error in the logfile:

´Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 250, in _async_setup_platform
await asyncio.shield(task)
File “/usr/local/lib/python3.9/concurrent/futures/thread.py”, line 52, in run
result = self.fn(*self.args, **self.kwargs)
File “/config/custom_components/abfallapi_regioit/sensor.py”, line 51, in setup_platform
base_url = CITIES[anbieter_id]
KeyError: 'COE’´

Seems like Coesfeld ist not recognized. Any help would be appreciated! Thanks a lot!

For whom it may concern, solved it: Should have used “Coesfeld” instead of “COE” :slight_smile:

can you add Zweckverband München-Südost?

Zweckverband München-Südost is supported by waste_collection_schedule.

1 Like

Upcoming Waste-collection-card
(Tile-Card and Auto-Entities)

The Card displays the next collection-dates for “Gelbe Tonne”, “Bioabfall”, “Restmüll” and “Papiertonne” and sorts them by “daysTo” (low → high). If daysTo ist 0 oder 1 the card will blink in the corresponding color (black, yellow, blue or grey).

image

Code for the sensors:

waste_collection_schedule:
  sources:
    - name: abfallnavi_de
      args:
        service: coe
        ort: Coesfeld
        strasse: Wester Esch
      customize:
        - type: "Restmüll 4 wö."
          alias: "Restmüll"
          show: true
          icon: "mdi:trash-can"
        - type: "Bioabfall"
          alias: "Bioabfall"
          show: true
          icon: "mdi:trash-can"
        - type: "Gelbe Tonne / Sack"
          alias: "Gelbe Tonne"
          show: true
          icon: "mdi:trash-can"
        - type: "Gelbe Tonne / Sack, Schadstoffmobil"
          alias: "Gelbe Tonne 2"
          show: true
          icon: "mdi:trash-can"
        - type: "Papier"
          alias: "Papiermüll"
          show: true
          icon: "mdi:trash-can"
sensor:
  - platform: waste_collection_schedule
    name: Muellsensor_alle
    value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%u")}}'
    types:
      - "Gelbe Tonne"
      - "Gelbe Tonne 2"
      - "Restmüll"
      - "Papiermüll"
      - "Bioabfall"
  - platform: waste_collection_schedule
    name: Muellsensor_Gelbe_Tonne
    value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%u")}}'
    add_days_to: true
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    types:
      - "Gelbe Tonne"
      - "Gelbe Tonne 2"
  - platform: waste_collection_schedule
    name: Muellsensor_Restmuell
    value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%u")}}'
    add_days_to: true
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    types:
      - "Restmüll"
  - platform: waste_collection_schedule
    name: Muellsensor_Papiertonne
    add_days_to: true
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%u")}}'
    types:
      - "Papiermüll"
  - platform: waste_collection_schedule
    name: Muellsensor_Bioabfall
    add_days_to: true
    date_template: '{{value.date.strftime("%d.%m.%Y")}}'
    value_template: '{{value.types|join(", ")}}|{{value.daysTo}}|{{value.date.strftime("%d.%m.%Y")}}|{{value.date.strftime("%u")}}'
    types:
      - "Bioabfall"
  - platform: waste_collection_schedule
    name: Muell_Next_Muellart
    details_format: upcoming
    value_template: '{{value.types|join(", ")}}'
    types:
      - "Gelbe Tonne"
      - "Gelbe Tonne 2"
      - "Restmüll"
      - "Papiermüll"
      - "Bioabfall"
  - platform: waste_collection_schedule
    name: Muell_Next_Tage
    details_format: upcoming
    value_template: "{{value.daysTo}}"
    types:
      - "Gelbe Tonne"
      - "Gelbe Tonne 2"
      - "Restmüll"
      - "Papiermüll"
      - "Bioabfall"
template:
  - sensor:
  
      - unique_id: template_muell_gelbe_tonne
        name: template_muell_gelbe_tonne
        icon: mdi:recycle
        state: >
          {% set wasteentity = "sensor.muellsensor_gelbe_tonne" %}
          {% if is_state_attr(wasteentity, "daysTo", 0) %}
            heute ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif is_state_attr(wasteentity, "daysTo", 1) %}
            morgen ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif state_attr(wasteentity, "daysTo") | int(0) < "7" | int(0) %} 
            in {{ state_attr(wasteentity,'daysTo') }} {{ iif(is_state_attr(wasteentity,'daysTo', 1), 'Tag', 'Tagen') }} am {{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }}
          {% else %}
            in {{ state_attr(wasteentity,'daysTo') }} Tagen ({{ states(wasteentity) | regex_replace("[A-Z,a-z,ä,ö,ü]","") | regex_replace("\|.$","") | regex_replace("\s","") | regex_replace("^\|.+\|","") | regex_replace(now().year | string,"") }})
          {% endif %}
        attributes:
          days_to: '{{state_attr("sensor.muellsensor_gelbe_tonne","daysTo")}}'
  
      - unique_id: template_muell_bioabfall
        name: template_muell_bioabfall
        icon: mdi:apple
        state: >
          {% set wasteentity = "sensor.muellsensor_bioabfall" %}
          {% if is_state_attr(wasteentity, "daysTo", 0) %}
            heute ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif is_state_attr(wasteentity, "daysTo", 1) %}
            morgen ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif state_attr(wasteentity, "daysTo") | int(0) < "7" | int(0) %}
            in {{ state_attr(wasteentity,'daysTo') }} {{ iif(is_state_attr(wasteentity,'daysTo', 1), 'Tag', 'Tagen') }} am {{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }}
          {% else %}
            in {{ state_attr(wasteentity,'daysTo') }} Tagen ({{ states(wasteentity) | regex_replace("[A-Z,a-z,ä,ö,ü]","") | regex_replace("\|.$","") | regex_replace("\s","") | regex_replace("^\|.+\|","") | regex_replace(now().year | string,"") }})
          {% endif %}
        attributes:
          days_to: '{{state_attr("sensor.muellsensor_bioabfall","daysTo")}}'
          
      - unique_id: template_muell_restmuell
        name: template_muell_restmuell
        icon: mdi:delete-empty
        state: >
          {% set wasteentity = "sensor.muellsensor_restmuell" %}
          {% if is_state_attr(wasteentity, "daysTo", 0) %}
            heute ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif is_state_attr(wasteentity, "daysTo", 1) %}
            morgen ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif state_attr(wasteentity, "daysTo") | int(0) < "7" | int(0) %}
            in {{ state_attr(wasteentity,'daysTo') }} {{ iif(is_state_attr(wasteentity,'daysTo', 1), 'Tag', 'Tagen') }} am {{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }}
          {% else %}
            in {{ state_attr(wasteentity,'daysTo') }} Tagen ({{ states(wasteentity) | regex_replace("[A-Z,a-z,ä,ö,ü]","") | regex_replace("\|.$","") | regex_replace("\s","") | regex_replace("^\|.+\|","") | regex_replace(now().year | string,"") }})
          {% endif %}
        attributes:
          days_to: '{{state_attr("sensor.muellsensor_restmuell","daysTo")}}'
  
      - unique_id: template_muell_papiermuell
        name: template_muell_papiermuell
        icon: mdi:file-outline
        state: >
          {% set wasteentity = "sensor.muellsensor_papiertonne" %}
          {% if is_state_attr(wasteentity, "daysTo", 0) %}
            heute ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif is_state_attr(wasteentity, "daysTo", 1) %}
            morgen ({{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }})
          {% elif state_attr(wasteentity, "daysTo") | int(0) < "7" | int(0) %}
            in {{ state_attr(wasteentity,'daysTo') }} {{ iif(is_state_attr(wasteentity,'daysTo', 1), 'Tag', 'Tagen') }} am {{ states(wasteentity) | regex_replace(".+\|","") | replace("0","So.") | replace("1","Mo.") | replace("2","Di.") | replace("3","Mi.") | replace("4","Do.") | replace("5","Fr.") | replace("6","Sa.") }}
          {% else %}
            in {{ state_attr(wasteentity,'daysTo') }} Tagen ({{ states(wasteentity) | regex_replace("[A-Z,a-z,ä,ö,ü]","") | regex_replace("\|.$","") | regex_replace("\s","") | regex_replace("^\|.+\|","") | regex_replace(now().year | string,"") }})
          {% endif %}
        attributes:
          days_to: '{{state_attr("sensor.muellsensor_papiertonne","daysTo")}}'

Code for the card

type: custom:auto-entities
card_param: cards
sort:
  method: attribute
  attribute: days_to
  numeric: true
card:
  type: vertical-stack
filter:
  include:
    - entity_id: sensor.template_muell*
      options:
        type: tile
        hold_action:
          action: more-info
        icon_color: >-
          {% if is_state_attr(config.entity, "friendly_name", "Gelbe Tonne") %}
            orange
          {% elif is_state_attr(config.entity, "friendly_name", "Papiertonne")
          %}
            blue
          {% elif is_state_attr(config.entity, "friendly_name", "Bioabfall") %}
            brown
          {% elif is_state_attr(config.entity, "friendly_name", "Restmüll") %}
            black
          {% endif %} 
        badge_color: red
        badge_icon: >-
          {% if state_attr(config.entity, "days_to") | int(default=0) <
          (states("input_number.mullabfuhr_warnen_x_tage_vor_abholung") | int+1)
          %}
            mdi:alert
          {% endif %} 
        card_mod:
          style: |
            ha-card {
              border: none !important;                        
              --tile-color: 
                  {% if is_state_attr(config.entity, "friendly_name", "Gelbe Tonne") %}
                    orange !important;
                  {% elif is_state_attr(config.entity, "friendly_name", "Papiertonne") %}
                    blue !important;
                  {% elif is_state_attr(config.entity, "friendly_name", "Bioabfall") %}
                    brown !important;
                  {% elif is_state_attr(config.entity, "friendly_name", "Restmüll") %}
                    grey !important;
                  {% endif %};                               
              background:
                animation:
                  {%- if state_attr(config.entity,'days_to') | int(default=0) < (states("input_number.mullabfuhr_warnen_x_tage_vor_abholung") | int+1) %};
                    animation: blink 2s linear 1s infinite;
                  {%- endif %}
              }                                                
            @keyframes blink {
              50% {
                background:
                  {% if is_state_attr(config.entity, "friendly_name", "Gelbe Tonne") %}
                    rgba(255, 165, 0, 0.2);
                  {% elif is_state_attr(config.entity, "friendly_name", "Papiertonne") %}
                    rgba(0, 191, 255, 0.2);
                  {% elif is_state_attr(config.entity, "friendly_name", "Bioabfall") %}
                    rgba(139, 69, 19, 0.2);
                  {% elif is_state_attr(config.entity, "friendly_name", "Restmüll") %}
                    rgba(128, 128, 128, 0.2);
                  {% endif %};                
                  } 
                }