heyajohnny / afvalinfo

Provides Home Assistant sensors for multiple Dutch waste collectors. The idea is to add more cities and features in the future.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Home Assistant sensor component/integration for waste collectors in the Netherlands

hacs_badge

icon_mini

Breaking changes for upgrading from v1.x.x to v2.x.x

If you've just updated from v1.x.x to v2.x.x please remove the afvalinfo sensor from your configuration.yaml and follow Installation step 2

Supported in 98% of the Dutch 'gemeenten'

Before you use this integration you can test if your address is supported and working over here. If you like my work, please buy me a coffee or donate some crypto currencies. This will keep me awake, asleep, or whatever 😉

Crypto currency addresses xmr btc ada iota

Please also take a look at the Vieze Geit Android app for trash pickup dates on your Android device.

Not supported gemeenten in the Netherlands

"edam-volendam", "haaksbergen", "oegstgeest", "oostzaan", "schiermonnikoog", "texel", "vlieland", "weert"

Important Info

This integration supports Diftar data and Cleanprofs cleaning dates

Installation step 1

There are 2 ways to install afvalinfo:

  1. Download 'afvalinfo' from the HACS store (this is the easiest and preferred way)
  2. Copy the files in the /custom_components/afvalinfo/ folder to: [homeassistant]/config/custom_components/afvalinfo/

Installation step 2

The next step is to add afvalinfo sensors to your Home Assistant:

  1. Browse to your Home Assistant config page
  2. Press Settings --> Devices & Services

image

  1. Press 'Add Integration' and search for 'afvalinfo' and select the 'afvalinfo' integration

image

  1. Fill in the form with your address details (Zip code + House Number (+ House number suffix))

(When you live in the municipality maassluis or ouder-amstel only fill in the Municipality + District and leave Zip code + House number + House number suffix empty. You can find the districts for ouder-amstel here and the districts for maassluis here)

image

And at the bottom of the page, add the sensors you'd like to see

image

These 2 sensors are special sensors

image

To make these sensors work, you also need to specify one or more of the normal sensors. These sensors will return one or more (seperated with a comma) of the other sensor friendly names, if of course these trash types will be picked up today/tomorrow. So if you only added PBD and Trash type today under your sensors, you will only get a result of 'PBD' if the trash type PBD has the same date as today. If there is no trash to pick up you'll gwt this value

image

(Optional) Installation step 3 (Change friendly name)

If you want to change the friendly name of the sensors (and also the names you see in the sensors 'Trash type today' and 'Trash type tomorrow') follow these steps.

  1. Press Settings --> Devices & Services
  2. Press 'x ENTITIES' inside the 'Afvalinfo' card

image

  1. Select the sensor whose friendly name you want to change

image

  1. Press the settings button in the upper right corner

image

  1. Change the value under 'Name' and press 'Update' in the bottom right corner

image

That's it! The friendly name should be changed

image

maassluis

For the gemeente maassluis you need to use the 'district'. Here you can see the supported districts (Not case sensitive):

"Binnenstad/centrum"
"Componistenwijk"
"Dalenbuurt"
"Dichtersbuurt"
"Drevenbuurt"
"Koningshoek"
"Maasdijk"
"Molenwijk"
"Oranjewijk"
"Sluispolder Oost"
"Vertowijk"
"Vogelwijk"
"Weverskade"
"Wijk 't Hoofd"
"Wilgenrijk"
"Zeeheldenbuurt"
"Zuidbuurt"

ouder-amstel

For the gemeente ouder-amstel you need to use the 'district'. Here you can see the supported districts (Not case sensitive):

"Bebouwde kom"
"Buitengebied"

Date format

dateformat:

If you want to adjust the way the date is presented. You can do it using the dateformat option. All python strftime options should work. Default is '%d-%m-%Y', which will result in per example:

21-9-2019
locale:

With locale you can present the date in any language you want (this only works for the day of the week (%a or %A) and the name of the month (%b or %B)). Here is a list of locales. If you use '%A %d %B %Y' for dateformat and 'nl' for locale, the date will be presented as:

zaterdag 21 september 2019

Attributes

There are 3 important attributes:

- days_until_collection_date.    This will return the number of days between today and the collection date.
- is_collection_date_today.      This will return true if the collection date is today and false if the collection date is not today.
- whole_year_dates.              This will return all the dates from today to the end of the year when 'getwholeyear' is set to true

If your location supports diftar and you've specified a diftarcode, these attributes are also available:

- last_collection_date.          This wil return the last diftar collection date.
- total_collections_this_year    This will return the total number of diftar collections for the current year

Example for usage of attributes. This example creates a new sensor with the attribute value 'days_until_collection_date' of the sensor 'sensor.afvalinfo_papier':

- platform: template
    sensors:
      paper_days_until_collection:
        value_template: "{{ state_attr('sensor.afvalinfo_home_papier', 'days_until_collection_date') }}"

And another template example to only show the first upcoming trashtype and pickup date (Special thanks to jaydouble)

- platform: template
  sensors:
    afvalinfo_home_next_trash_type_and_date:
      value_template: >
        {% set ns = namespace(minimum=365) %}
        {% set list = ['groente_fruit_en_tuinafval', 'kerstboom', 'plastic_blik_en_drankkartons', 'papier', 'restafval', 'takken', 'textiel'] %}
        {% set friendly_list = ['Groente Fruit en Tuinafval', 'Kerstboom', 'Plastic Blik en Drankkartons', 'Papier', 'Restafval', 'Takken', 'Oude Kleding'] %}
        {%- for l in list %}
        {%- set days = state_attr('sensor.afvalinfo_home_' ~l, 'days_until_collection_date')%}
        {%- if days != None and days < ns.minimum %}
        {%- set ns.minimum = days %}
        {%- endif %}
        {%- endfor %}
        {%- for l in list %}
        {%- set days = state_attr('sensor.afvalinfo_home_' ~l, 'days_until_collection_date')%}
        {%- if days == ns.minimum %}
        {{friendly_list[loop.index0]}} · {{ states('sensor.afvalinfo_home_' ~l) }}
        {%- endif %}
        {%- endfor %}

Lovelace UI

Please take a look @ bafplus. He made some awesome Lovelace cards for Afvalinfo.

Issues

If there are any problems with the integration, please first test your address over here. If it works there, you've done something wrong in your configuration.yaml. You can try generating a new config over here. Otherwise create an issue here

About

Provides Home Assistant sensors for multiple Dutch waste collectors. The idea is to add more cities and features in the future.

License:GNU General Public License v3.0


Languages

Language:Python 100.0%