1. Introduction
In an earlier article we explained how to setup a Home Assistant dashboard card with garbage pickup dates. This article describes how to setup a garbage pickup notification the evening before the waste bin needs to be put alongside the street to be emptied.
The notification setup described in this article is based on the usage of the Home Assistant integration AfvalWijzer, but if you use a different integration a similar process can be followed to implement a garbage pickup notification. The automatic notification will be created via a Home Assistant Automation.
2. Requirements
The following is required to setup the notification:
- The Home Assistant integration AfvalWijzer;
- Pushover account and Home Assistant Pushover integration setup. See Setting up Pushover notifications in Home Assistant.
3. Configuration
No specific configuration is required as long as the Afvalwijzer integration is configured correctly (see article Home Assistant dashboard card with garbage pickup dates).
4. Create a basic garbage pickup notification Automation
Follow the following steps:
- Head over to Settings > Automations & Scenes, create a new empty automation and give it a name, for example “Notification – Waste bins”
- Click on “Add action” and select “Call service”
- Enter pushover at the Service entry field and select the Pushover user connection to use.
Note: if multiple users need to receive the same message it is handier to define a group within your Pushover account. -
Define the notification content
- Enter the body of the message. As we will define that HTML codes need to be interpreted in step 4 the following customisations are possible:
- <b>word</b> – display word in bold
- <i>word</i> – display word in italics
- <u>word</u> – display word underlined
- <font color=”blue”>word</font> – display word in blue text (most colors and hex codes permitted)
- <a href=”http://example.com/”>word</a> – display word as a tappable link to http://example.com/
- Enter the title of the notification
- Skipped as not used
- Options as described in the Pushover API:
attachment
– an image attachment to send with the messagedevice
– the name of one of your devices to send just to that device instead of all deviceshtml
– set to1
to enable HTML parsingpriority
– a value of-2
,-1
,0
(default),1
, or2
sound
– the name of a supported sound to override your default sound choicetimestamp
– a Unix timestamp of a time to display instead of when our API received iturl
– a supplementary URL to show with your messageurl_title
– a title for the URL specified as theurl
parameter, otherwise just the URL is shown
- Enter the body of the message. As we will define that HTML codes need to be interpreted in step 4 the following customisations are possible:
- Save the Automation and run it
The following garbage pickup notification will be displayed on the mobile device:
5. Create a more sophisticated garbage pickup notification
I wanted to have one notification which:
- provides message indicating which waste container to put alongside the road
- provides image of the container for the specific waste type
My setup will send one of the following notification depending on the waste type the evening before the waste container needs to be put alongside the street.
Setting up this notification is not possible via the visual editor for the Automation, but requires YAML code.
- Head over to Settings > Automations & Scenes and create a new automation by clicking on the “Create automation” button at the lower right.
- In the upper right click the 3 dots and select Edit in YAML
- Remove existing content of the editor and copy/paste the following code:
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364alias: Notification - Wastedescription: ""trigger:- platform: timeat: "20:00:00"condition:- condition: numeric_stateattribute: days_until_collection_dateentity_id: sensor.afvalwijzer_restafvalbelow: "2"action:- service: tts.google_translate_saydata:entity_id: media_player.woonkamer_nest_minimessage: |-{% set days= states('sensor.afvalwijzer_next_in_days') %}{% set day= 'Morgen' if days == 1 else 'Vandaag' %}{% set wastetype= states('sensor.afvalwijzer_next_type') %}{% if wastetype == 'restafval' %}{% set phrase =day + ' moet de grijze container met restafval aan de straat.' %}{% elif wastetype == 'gft' %}{% set phrase = day + ' moet de groene container met GFT afval aan de straat.' %}{% elif wastetype == 'papier' %}{% set phrase = day + ' kan de oud papier container aan de straat.' %}{% elif wastetype == 'pmd' %}{% set phrase = day + ' moet de plastic container aan de straat.' %}{% endif %}{{phrase}}language: nlenabled: true- service: notify.pushover_group_gezin_home_assistantdata_template:title: Afvalmessage: |-{% set days= states('sensor.afvalwijzer_next_in_days') %}{% set day= 'Morgen' if days == 1 else 'Vandaag' %}{% set wastetype= states('sensor.afvalwijzer_next_type') %}{% if wastetype == 'restafval' %}{% set phrase =day + ' moet de grijze container met restafval aan de straat.' %}{% elif wastetype == 'gft' %}{% set phrase = day + ' moet de groene container met GFT afval aan de straat.' %}{% elif wastetype == 'papier' %}{% set phrase = day + ' kan de oud papier container aan de straat.' %}{% elif wastetype == 'pmd' %}{% set phrase = day + ' moet de plastic container aan de straat.' %}{% endif %}{{phrase}}<BR>data:attachment: >-{% set wastetype= states('sensor.afvalwijzer_next_type') %}{% if wastetype == 'restafval' %}{% set img ='afvalcontainer - grijs.png' %}{% elif wastetype == 'gft' %}{% set img='afvalcontainer - groen.png' %}{% elif wastetype == 'papier' %}{% set img='afvalcontainer - blauw.png' %}{% elif wastetype == 'pmd' %}{% set img='afvalcontainer - grijsoranje.png' %}{% endif %} /config/www/images/afvalwijzer/{{img}}html: 1sound: bikemode: single
The code above will not work straight away for your situation. At least the yellow highlighted lines require modifications. Likely some other lines also. The images I used are available for download: 20221216 images waste containers
0 Comments