German Müllabfuhr sensor (regioIT)

Hello can anyone tell me how to integrate Kerpen? The data is right here.

or here

@karl1986 This is unrelated to the offered addons. Take a look in the original thread: Home-Assistant integration of 'Abfall.IO' waste collection dates & schedule

Could it be that at the moment the api dosn*t work at the moment? I can get the street and the city but i cannot get the dates.

There are multiple API endpoints (Anbieter) involved. For Pinneberg for example everything works fine, but I don’t know about the other Anbieter.

@karl1986 @Slash You might be able to integrate your particular service provider using the ICS integration from HACS (or from here https://github.com/KoljaWindeler/ics)
For that you simply need an online available calendar file (ics) which most provider offer nowadays.
JKW

1 Like

I will give it a try, thanks

Just wanted you let you know that I created a framework which supports multiple waste collection services, including RegioIT. The framework provides some extra features, including wizard’s which help to get the configuration settings for a lot of cities.

Have fun!

in the combination with the HA telegram bot notification or Alexa Mediaplayer Integration, thats a great reminder function. The special with the Telegram notification is that it is possible to stop the reminder funktion afte the bin is at the street and the different possibles are great for all of us the shift this work until the last chance :wink: i found this example and use this for the automation of the Recycle bin automation but than i find out it is also useful for reminder notifications with other Background like reminders to close windows etc.

- id: 'muelltonnen_rausstellen'
  alias: 'Mülltonnen rausstellen'
  trigger:
    - platform: time
      at: "18:00:00"
    - entity_id: binary_sensor.someone_is_home
      from: 'off'
      platform: state
      to: 'on'
  condition:
    - condition: and
      conditions:
      - condition: time
        after: '09:00:00'
      - condition: time
        before: '23:00:00'
      - condition: template
        value_template: "{{ (states.sensor.muellabfuhr.state != 'Keine') and (states.sensor.muellabfuhr.state != 'unknown') }}"
  action:
  - service: notify.mobile_app_daniels_iphone
    data_template:
      message: '{{ states.sensor.muellabfuhr.state }}'
      data:    
  - service: notify.telegram_group
    data_template:
      message: '{{ states.sensor.muellabfuhr.state }}'
      data:
          inline_keyboard:
          - '30 Minutes:/30m, 1 Hour:/1h, 3 Hours:/3h'
          - 'OK:/okay, No reminder:/removekeyboard'

- id: 'telegramrepeat30m'
  alias: 'Telegram callback to repeat message in 30 minutes'
  
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/30m'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK, reminding you in 30 minutes'
  - service: telegram_bot.edit_replymarkup
    data_template:
      message_id: '{{ trigger.event.data.message.message_id }}'
      chat_id: '{{ trigger.event.data.user_id }}'
      inline_keyboard: []
  - delay: '00:30:00'
  - service: notify.telegram_northpower25home
    data_template:
      message: '{{ trigger.event.data.message.text }}'
      data:
        inline_keyboard:
          - '30 Minutes:/30m, 1 Hour:/1h, 3 Hours:/3h'
          - 'No reminder:/removekeyboard'

- id: 'telegramrepeat1h'
  alias: 'Telegram callback to repeat message in 1 hour'
  
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/1h'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK, reminding you in 1 hour'
  - service: telegram_bot.edit_replymarkup
    data_template:
      message_id: '{{ trigger.event.data.message.message_id }}'
      chat_id: '{{ trigger.event.data.user_id }}'
      inline_keyboard: []
  - delay: '01:00:00'
  - service: notify.telegram_group
    data_template:
      message: '{{ trigger.event.data.message.text }}'
      data:
        inline_keyboard:
          - '30 Minutes:/30m, 1 Hour:/1h, 3 Hours:/3h'
          - 'No reminder:/removekeyboard'

- id: 'telegramrepeat3h'
  alias: 'Telegram callback to repeat message in 3 hour'
  
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/3h'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK, reminding you in 3 hour'
  - service: telegram_bot.edit_replymarkup
    data_template:
      message_id: '{{ trigger.event.data.message.message_id }}'
      chat_id: '{{ trigger.event.data.user_id }}'
      inline_keyboard: []
  - delay: '03:00:00'
  - service: notify.telegram_group
    data_template:
      message: '{{ trigger.event.data.message.text }}'
      data:
        inline_keyboard:
          - '30 Minutes:/30m, 1 Hour:/1h, 3 Hours:/3h'
          - 'No reminder:/removekeyboard'        

- id: 'telegramremovemessage'
  alias: 'Telegram callback message'
  
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/okay'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK'
  - service: telegram_bot.delete_message
    data_template:
      message_id: '{{ trigger.event.data.message.message_id }}'
      chat_id: '{{ trigger.event.data.user_id }}'
      inline_keyboard: []

- id: 'telegramremoveinline'
  alias: 'Telegram callback to remove keyboard'
  
  trigger:
    platform: event
    event_type: telegram_callback
    event_data:
      data: '/removekeyboard'
  action:
  - service: telegram_bot.answer_callback_query
    data_template:
      callback_query_id: '{{ trigger.event.data.id }}'
      message: 'OK'
  - service: telegram_bot.edit_replymarkup
    data_template:
      message_id: '{{ trigger.event.data.message.message_id }}'
      chat_id: '{{ trigger.event.data.user_id }}'
      inline_keyboard: []

Kolja, many thanks for the super tool. Can you tell me how to get my ICS from this site? https://www.schoenmackers.de/rund-um-service/muellalarm/

I have found out the following address

https://api.abfall.io/?key=e5543a3e190cb8d91c645660ad60965f&modus=d6c5855a62cf32a4dadbc2831f0f295f&waction=export_ics

in the visualization I get this error “no next event (-1)”

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 %};                
                  } 
                }