Created
August 20, 2021 06:51
-
-
Save TheGroundZero/92b3c23524c4ee28a7633aad692b149b to your computer and use it in GitHub Desktop.
Custom sensor based of Pippyn's Afvalbeheer integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Waste collection integration | |
# | |
# Home Assisant sensor component for Afvalbeheer | |
# https://github.com/pippyn/Home-Assistant-Sensor-Afvalbeheer | |
# | |
# sensor: | |
- platform: afvalbeheer | |
wastecollector: RecycleApp # Change this to match your waste collector | |
resources: | |
- restafval | |
- papier | |
- pmd | |
# - gft | |
postcode: 1234 # changeme | |
streetname: Sesamstraat # changeme | |
streetnumber: 123 # changeme | |
upcomingsensor: 0 | |
dateformat: '%Y-%m-%d' | |
dateobject: 0 | |
dateonly: 1 | |
dayofweek: 0 | |
alwaysshowday: 0 | |
name: '' | |
nameprefix: 0 | |
builtinicons: 1 | |
disableicons: 0 | |
dutch: 1 | |
# Custom sensor (optional) | |
# | |
# sensor: | |
- platform: template | |
sensors: | |
papier_ophaling: | |
friendly_name: "Papierophaling" | |
value_template: > | |
{%- set today = as_timestamp(now().strftime('%Y-%m-%d')) -%} | |
{%- set collection_date = as_timestamp(states('sensor.papier')) -%} | |
{%- if today == collection_date -%} | |
Vandaag | |
{%- elif (today + 86400) == collection_date -%} | |
Morgen | |
{%- else -%} | |
{{ collection_date | timestamp_custom('%d %B', true) }} | |
{% endif %} | |
pmd_ophaling: | |
friendly_name: "PMD ophaling" | |
value_template: > | |
{%- set today = as_timestamp(now().strftime('%Y-%m-%d')) -%} | |
{%- set collection_date = as_timestamp(states('sensor.pmd')) -%} | |
{%- if today == collection_date -%} | |
Vandaag | |
{%- elif (today + 86400) == collection_date -%} | |
Morgen | |
{%- else -%} | |
{{ collection_date | timestamp_custom('%d %B', true) }} | |
{% endif %} | |
restafval_ophaling: | |
friendly_name: "Restafval ophaling" | |
value_template: > | |
{%- set today = as_timestamp(now().strftime('%Y-%m-%d')) -%} | |
{%- set collection_date = as_timestamp(states('sensor.restafval')) -%} | |
{%- if today == collection_date -%} | |
Vandaag | |
{%- elif (today + 86400) == collection_date -%} | |
Morgen | |
{%- else -%} | |
{{ collection_date | timestamp_custom('%d %B', true) }} | |
{% endif %} | |
# Lovelace | |
# | |
# Uses https://github.com/ofekashery/vertical-stack-in-card | |
# | |
type: custom:vertical-stack-in-card | |
horizontal: true | |
cards: | |
- type: picture-entity | |
entity: sensor.restafval_ophaling | |
image: /local/img/garbage/afval-rest_bw.png | |
state_image: | |
Vandaag: /local/img/garbage/afval-rest_now.png | |
Morgen: /local/img/garbage/afval-rest.png | |
show_name: false | |
show_state: true | |
- type: picture-entity | |
entity: sensor.pmd_ophaling | |
image: /local/img/garbage/afval-pmd_bw.png | |
state_image: | |
Vandaag: /local/img/garbage/afval-pmd_now.png | |
Morgen: /local/img/garbage/afval-pmd.png | |
show_name: false | |
show_state: true | |
- type: picture-entity | |
entity: sensor.papier_ophaling | |
image: /local/img/garbage/afval-papier_bw.png | |
state_image: | |
Vandaag: /local/img/garbage/afval-papier_now.png | |
Morgen: /local/img/garbage/afval-papier.png | |
show_name: false | |
show_state: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment