Component to integrate with mijnafvalwijzer, afvalstoffendienstkalender and rova.
This custom component dynamically creates sensor.afvalwijzer_* items. For me personally the items created are gft, restafval, papier, pmd and kerstbomen. Look in the states overview in the developer tools in Home Assistant what the sensor names for your region are and modify where necessary.
This component will set up the following platforms.
Platform | Description |
---|---|
sensor |
Show waste pickup dates for mijnafvalwijzer.nl, afvalstoffendienstkalender.nl or rova.nl. |
The second row sorts the waste items by date using the following lovelace code
- type: 'custom:auto-entities'
card:
type: glance
filter:
include:
- entity_id: sensor.afvalwijzer_gft
- entity_id: sensor.afvalwijzer_papier
- entity_id: sensor.afvalwijzer_pmd
- entity_id: sensor.afvalwijzer_restafval
sort:
attribute: days_until_collection_date
method: attribute
numeric: true
More information on the reminders (ios in this case):
- https://github.com/xirixiz/my-hass-config/blob/master/packages/waste.yaml
- https://github.com/xirixiz/my-hass-config/blob/05d8755a737676b60faac98dc0cce91d06277939/configuration.yaml#L73
- Using your tool of choice open the directory (folder) for your HA configuration (where you find
configuration.yaml
). - If you do not have a
custom_components
directory (folder) there, you need to create it. - In the
custom_components
directory (folder) create a new folder calledafvalwijzer
. - Download all the files from the
custom_components/afvalwijzer/
directory (folder) in this repository. - Place the files you downloaded in the new directory (folder) you created.
- Look at the
Example Configuration
section for further configuration.
Using your HA configuration directory (folder) as a starting point you should now also have this:
custom_components/afvalwijzer/__init__.py
custom_components/afvalwijzer/manifest.json
custom_components/afvalwijzer/sensor.py
https://github.com/home-assistant/example-custom-config/tree/master/custom_components/example_sensor
In order to extend the log level, modify the following (configuration.yaml probably)
logger:
default: info
logs:
custom_components.afvalwijzer: debug
Here's an example of my own Home Asisstant config: https://github.com/xirixiz/home-assistant
sensor:
- platform: afvalwijzer
provider: mijnafvalwijzer # (required, default = mijnafvalwijzer) either choose mijnafvalwijzer, afvalstoffendienstkalender or rova
postal_code: 1234AB # (required, default = '')
street_number: 5 # (required, default = '')
suffix: '' # (optional, default = '')
include_date_today: false # (optional, default = false) to take or not to take Today into account in the next pickup.
default_label: Geen # (optional, default = Geen) label if no date found
id: '' # (optional, default = '') use if you'd like to have multiple waste pickup locations in HASS
exclude_list: '' # (optional, default = '') comma separated list of wast types (case ignored). F.e. "papier, gft"
input_boolean:
waste_moved:
name: Waste has been moved
initial: 'off'
icon: mdi:delete-empty
waste_reminder:
name: Waste reminder enabled
initial: 'on'
automation:
- alias: Afval - Herstel notificatie
trigger:
platform: state
entity_id: input_boolean.waste_moved
to: "on"
for:
hours: 12
action:
- service: input_boolean.turn_off
entity_id: input_boolean.waste_moved
- service: input_boolean.turn_on
entity_id: input_boolean.waste_reminder
- alias: Afval - Bevestig notificatie
trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "MARK_WASTE_MOVED"
action:
- service: input_boolean.turn_on
entity_id: input_boolean.waste_moved
- service: notify.family
data:
title: 'Afval'
message: 'Afvaltype(n): {{ states.sensor.afvalwijzer_tomorrow_formatted.state }} zijn aan de straat gezet.'
data:
push:
badge: 0
- alias: Afval - Verzend notificatie - Tomorrow
trigger:
platform: time_pattern
hours: "/1"
condition:
condition: and
conditions:
- condition: state
entity_id: input_boolean.waste_moved
state: "off"
- condition: state
entity_id: input_boolean.waste_reminder
state: "on"
- condition: time
after: "18:00:00"
before: "23:00:00"
- condition: template
value_template: "{{ states('sensor.afvalwijzer_tomorrow_formatted') != 'Geen' }}"
action:
- service: notify.family
data:
title: 'Afval'
message: 'Het is vandaag - {{ now().strftime("%d-%m-%Y") }}. Afvaltype(n): {{ states.sensor.afvalwijzer_tomorrow_formatted.state }} wordt opgehaald op: {{ (as_timestamp(now()) + (24*3600)) | timestamp_custom("%d-%m-%Y", True) }}!'
data:
actions:
- action: "MARK_WASTE_MOVED"
title: "Afval verwerkt"
activationMode: "background"
authenticationRequired: no
destructive: yes
behavior: "default"
push:
badge: 5