so i’d like to sort on DATE then. So in this example it should show first restafval, then plastic and then gft.
in the inspect i’m not sure what to see (reed: dont understand where it is related to)
so i’d like to sort on DATE then. So in this example it should show first restafval, then plastic and then gft.
in the inspect i’m not sure what to see (reed: dont understand where it is related to)
right, one step back… and this is rather fundamental for HA, so you need to understand what we’re doing here. simply finding a state (an entity) and check its attributes
go to /developer-tools/state
(click left menu developer tools and land on state) then, enter the sensor.afvalwijzer_gft in the States column to reveal the attributes it has
and for the inspector: check the bottom part of you image, and what is says:
None has no attribute attributes
that means you are referring a non existing state.
as does the auto-entities card, returning: 404 not found
ok. thanks. step by step.
Found the attributes for entity GFT
last_update: 12-11-2020 10:53
hidden: false
days_until_collection_date: 7
is_collection_date_today: false
is_collection_date_tomorrow: false
is_collection_date_day_after_tomorrow: false
year_month_day_date: 2020-11-19
friendly_name: afvalwijzer gft
icon: mdi:recycle
Right! (Btw please post code in code blocks, using the </> )
Now you know what you should change in the auto-entities card
So i need: days_until_collection_date that works.
Now lets see how i can change the mdi to images like here https://github.com/xirixiz/homeassistant-afvalwijzer/blob/772a09f003eb6791353476019cacac23c2a7b88c/afvalwijzer-lovelace.png
Hi @Mariusthvdb
I’ve been busy with implementation of afvalwijzer this afternoon and it took me some time to find out everything since I just started with HA around a week ago so I’m still figuring out a lot.
I installed Afvalwijzer and the lovelace things to get the custom entity card going but for me somethings are not working.
Let’s start with the sensor for plastic… Every sensor is working except for plastic. Can you explain where something goes wrong?
shows us your template and sensor configuration please, so we can have a look
- platform: afvalwijzer # Sensor afvalwijzer
provider: mijnafvalwijzer
postal_code: !secret postcode
street_number: !secret huisnummer
include_date_today: true
default_label: Geen
- platform: template
sensors:
afvalwijzer_restafval_next:
friendly_name: Restafval
entity_picture_template: /local/afvalwijzer/rest.png
value_template: >
{{state_attr('sensor.afvalwijzer_restafval','days_until_collection_date')}}
attribute_templates:
day: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))
|timestamp_custom('%A')}}
date: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))
|timestamp_custom('%a %d %b')}}
timestamp: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_restafval'),'%d-%m-%Y'))}}
afvalwijzer_gft_next:
friendly_name: GFT
entity_picture_template: /local/afvalwijzer/gft.png
value_template: >
{{state_attr('sensor.afvalwijzer_gft','days_until_collection_date')}}
attribute_templates:
day: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_gft'),'%d-%m-%Y'))
|timestamp_custom('%A')}}
date: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_gft'),'%d-%m-%Y'))
|timestamp_custom('%a %d %b')}}
timestamp: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_gft'),'%d-%m-%Y'))}}
afvalwijzer_plastic_next:
friendly_name: Plastic
entity_picture_template: /local/afvalwijzer/plastic.png
value_template: >
{{state_attr('sensor.afvalwijzer_plastic','days_until_collection_date')}}
attribute_templates:
day: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))
|timestamp_custom('%A')}}
date: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))
|timestamp_custom('%a %d %b')}}
timestamp: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))}}
afvalwijzer_papier_next:
friendly_name: Papier
entity_picture_template: /local/afvalwijzer/papier.png
value_template: >
{{state_attr('sensor.afvalwijzer_papier','days_until_collection_date')}}
attribute_templates:
day: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_papier'),'%d-%m-%Y'))
|timestamp_custom('%A')}}
date: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_papier'),'%d-%m-%Y'))
|timestamp_custom('%a %d %b')}}
timestamp: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_papier'),'%d-%m-%Y'))}}
Problem is he doesnt even find the sensor.afvalwijzer_plastic at all, while it does find papier gft and rest.
Check to see if your provider changed the trash name. Here plastic is called Pmd now …
You’re right!
So if I would change the sensor to pmd instead of plastic I should be good and with a restart it should also create the right sensor.afvalwijzer_pmd?
Thanks so far!
EDIT: Changed to sensor.afvalwijzer_pmd_next but still nothing… Where can I change something like this elsewhere?
EDIT 2: I see that I can only ask for notification for restafval gft and papier, is this the reason why the plastic sensor wont show up maybe? In my gemeente they call it ‘plastic verpakkingsmateriaal en drankkartons’ but this one isnt able to be set up for notification. Thats why my thought is why I might not be able to configure the plastic sensor, am I right?
its the template sensor you need to change:
afvalwijzer_plastic_next:
friendly_name: Plastic
entity_picture_template: /local/afvalwijzer/plastic.png
value_template: >
{{state_attr('sensor.afvalwijzer_plastic','days_until_collection_date')}}
attribute_templates:
day: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))
|timestamp_custom('%A')}}
date: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))
|timestamp_custom('%a %d %b')}}
timestamp: >
{{as_timestamp(strptime(states('sensor.afvalwijzer_plastic'),'%d-%m-%Y'))}}
replace all ‘plastic’ with ‘phd’ and you’re set probably.
can you show the developer-tools/state with a search for afvalwijzer?
haha, now see it is ‘plastic’ back again overhere
Ill try this, I just edited my previous post, is this relevant information?
EDIT 2: I see that I can only ask for notification for restafval gft and papier, is this the reason why the plastic sensor wont show up maybe? In my gemeente they call it ‘plastic verpakkingsmateriaal en drankkartons’ but this one isnt able to be set up for notification. Thats why my thought is why I might not be able to configure the plastic sensor, am I right?
yes, only restafval, papier en gft. which is odd really. you might have to ping @xirixiz and ask him if he can check with you address data. especially if you can see the trash type in your App, or in the api data in mijnafvalwijzer.nl
and yes, if the integration doesn’t create the sensor, you can’t create the template sensor based on that
Perfect, ill send him a message. Thanks so far again.
Yes, I just send you a pm
fwiw, here’s an auto-entities card, based solely on the sensors the integration makes, (and ditches with my previous custom made template sensors). All I did was move these templates into the template-entity-row option, and had to exclude some of the other sensors:
- type: custom:auto-entities
card:
type: entities
title: Volgende ophaaldata
filter:
exclude:
- entity_id: sensor.afvalwijzer*next*
- entity_id: sensor.afvalwijzer*to*
include:
- entity_id: sensor.afvalwijzer_*
options:
type: custom:template-entity-row
state: >
{{as_timestamp(strptime(states(config.entity),'%d-%m-%Y'))
|timestamp_custom('%-d %b')}}
secondary: >
{% set count = state_attr(config.entity,'days_until_collection_date')|int %}
{% set day = as_timestamp(strptime(states(config.entity),'%d-%m-%Y'))
|timestamp_custom('%A') %}
{% set dagen =
{'Monday': 'Maandag',
'Tuesday': 'Dinsdag',
'Wednesday': 'Woensdag',
'Thursday': 'Donderdag',
'Friday': 'Vrijdag',
'Saturday': 'Zaterdag',
'Sunday': 'Zondag'} %}
{% set dag = dagen[day] if day in dagen else day %}
{% set unit = 'Dag' if count == 1 else 'dagen' %}
{% if count >= 14 %} {% set phrase = dag + ' over 2 weken' %}
{% elif count >= 7 %} {% set phrase = 'Volgende week ' + dag %}
{% elif count >= 3 %} {% set phrase = 'komende ' + dag %}
{% elif count == 2 %} {% set phrase = dag + ', overmorgen' %}
{% elif count == 1 %} {% set phrase = 'morgen, ' + dag %}
{% else %} {% set phrase = 'Vandaag, ' + dag %}
{% endif %}
{{phrase}} {% if count != 0%} ({{count}} {{unit}}) {% endif %}
sort:
method: state
numeric: true
just to notify here too the sensors for today, tomorrow, and day after tomorrow are broken, as an issue was posted here.
Hi have intergrade my sensor but now i will a day before a notify to my phone that the garbage pickup.
Does anyone have a example how i make that easy?
This automation will send a push notification every hour between 17:00 and 20:00 the day before pickup:
- alias: Afval notificatie
trigger:
platform: time_pattern
minutes: '/59'
seconds: 00
condition:
condition: and
conditions:
- condition: time
after: '17:00:00'
before: '20:00:00'
- condition: template
value_template: "{{ states('sensor.afvalwijzer_tomorrow') != 'Geen' }}"
action:
- service: notify.push
data:
title: "Afval"
message: 'Morgen: {{ states.sensor.afvalwijzer_tomorrow.state }}'