Garbage pickup date (mijnafvalwijzer.nl) custom_component

Please read first before asking….

Just starting using the integration and works pretty well, thanks! Managed to get the cards looking like this:

image

Was wondering if it is possible to have the same sorting functionality on a horizontal stack (or other way) to have it more look like this:

image

I had a similar few using the today formatted and tomorrow formatted sensors, however I would prefer not showing tomorrow if there is nothing getting picked up. Or can i modify the sensors to reflect like: today_formatted, next_formatted,

This could be usefull for you as a starting point. Maybe there is a smarter way as sorting doesn’t work in this setup. In order to do so, you need to define template sensors that only show a short date I believe. @Mariusthvdb probably knows best :slight_smile:

type: custom:auto-entities
card:
  type: horizontal-stack
  cards:
    - type: picture-entity
      entity: sensor.afvalwijzer_gft
      image: /local/afvalwijzer/GFT.png
      show_name: false
    - type: picture-entity
      entity: sensor.afvalwijzer_papier
      image: /local/afvalwijzer/Papier.png
      show_name: false
    - type: picture-entity
      entity: sensor.afvalwijzer_pmd
      image: /local/afvalwijzer/PMD.png
      show_name: false
    - type: picture-entity
      entity: sensor.afvalwijzer_restafval
      image: /local/afvalwijzer/Restafval.png
      show_name: false
filter:
  include:
    - entity: sensor.afvalwijzer_gft
    - entity: sensor.afvalwijzer_papier
    - entity: sensor.afvalwijzer_pmd
    - entity: sensor.afvalwijzer_restafval
sort:
  method: state
  reverse: true

just use a visibility or conditional condition? (depending on the card you use, visibility option is available or not)

that card doesnt sort, because the auto-entities doesn’t do anything there, this probably shows the same:

  type: horizontal-stack
  cards:
    - type: picture-entity
      entity: sensor.afvalwijzer_gft
      image: /local/afvalwijzer/GFT.png
      show_name: false
    - type: picture-entity
      entity: sensor.afvalwijzer_papier
      image: /local/afvalwijzer/Papier.png
      show_name: false
    - type: picture-entity
      entity: sensor.afvalwijzer_pmd
      image: /local/afvalwijzer/PMD.png
      show_name: false
    - type: picture-entity
      entity: sensor.afvalwijzer_restafval
      image: /local/afvalwijzer/Restafval.png
      show_name: false

since that is a fixed horizontal-stack, the sort option has no effect.

It is a much seen mistake, people adding only a list of entities, in stead of using the magic of auto-entities, based on a filter

I am using this as base selector:

    - type: custom:auto-entities
      card:
        type: entities
      filter:
        exclude:
          - entity_id: sensor.afvalwijzer*next*
          - entity_id: sensor.afvalwijzer_*orgen
          - entity_id: sensor.afvalwijzer_v*
        include:
          - entity_id: sensor.afvalwijzer_*
            options:

and, under the bottom options there declare which card I want to populate with the entities, in my case type: custom:template-entity-row

if you’d want to populate a horizontal-stack or ‘grid’ like below, with type:picture-entity as follows.
(mind you, it is a bit complex to auto display those images, as we really need to set an explicit image source on the type: picture-entity as it wont auto-show the available entity-picture unfortunately. Please see this as an exercise because of that)

type: custom:auto-entities
card:
  type: grid
  title: Auto populate cards
card_param: cards
filter:
  include:
    - entity_id: sensor.afvalwijzer*
      options:
         type: custom:hui-element
         card_type: button
         show_state: true
         show_name: true

in the above auto-entities, you can set other options, excludes etc etc now based on the state of the entities

if you dont want it to show entities with state ‘green’, simply instruct the auto-entities include options:

you can get crafty (as said, its more complex…) and use the template filter:

type: custom:auto-entities
card:
  type: horizontal-stack
  title: Auto populate cards
card_param: cards
filter:
  template: >
    [{% for s in integration_entities('afvalwijzer') %}
    {% if state_attr(s,'entity_picture') is not none %}
      {{
        {
          'type': 'picture-entity',
          'entity': s,
          'image': state_attr(s,'entity_picture')
        }
      }},
    {% endif %}
    {%- endfor %}]

or. you can move the complete styling to eg custom: button-card and return to the easier includes/excludes:

type: custom:auto-entities
card:
  type: grid
  columns: 4
card_param: cards
filter:
  include:
    - integration: afvalwijzer
      options:
        type: custom:button-card
        show_state: true
        template: button_picture
  exclude:
    - entity_id: sensor.afvalwijzer*next*
    - entity_id: sensor.afvalwijzer_*orgen
    - entity_id: sensor.afvalwijzer_v*
sort:
 method: state

options galore :wink:

1 Like

Thanks a lot! I will have a look at the options you provided.

Hello everyone,

I am very new to HA (±2 months) and i am trying to learn everything by scratch.
How do you guys put the images in the www folder and use it with the integration?

I manage to upload the images, but i cant see the image in the folder and cant use it with the picto’s. When i use a seperate image card, i can see the image with the local path (/local/community/afvalwijzer/gft1.png), but when i edit the entity, the pico change to blank when i paste the path shown above.

Looking forward to your help

When i got this done, i want to work with the auto entities card.

I just saw the 2.0.0-update of HACS coming in on HA, and it mentions a few breaking changes.

Is the current version of this plug-in compatible with HACS 2.0.0, or will installing that break this?

I updated HACS and everything works fine

Great, but honestly also kind of confusing. One of the breaking changes is the removal of the sensor-platform. In my YAML (which I mostly copied from @xirixiz), there are quite a couple of sensor-declarations. Or is this something else entirely?

This is about a specific sensor that HACS used to provide, not your YAML sensors from other platforms.

1 Like

Ah, I see. Thanks!

Not getting good data from api.
I don’t think this is for all areas, but certainly in my area.
This also works on the mobile app, but not on the web version: browsing the actual web-site using Chrome also gives no data.

Example of API response:
,
“max_tips”: 10,
“period_timer”: 15,
“location”: {
“response”: “NOK”,
“data”: false,
“error”: “NOT ALLOWED”
},
“notifications”: {
“response”: “OK”,
“data”: true,
“error”: “”
},
“notificationsTimer”: {
“response”: “OK”,
“data”: [
“15:00”,
“09:00”
],
“error”: “”
},
“reportGarbage”: {
“response”: “NOK”,
“data”: false,
“error”: “NOT ALLOWED”
},
“reportGarbageList”: {
“response”: “NOK”,
“data”: ,
“error”: “Error. No exist a list of waste type for this customer”
},
“afvalshop”: {
“response”: “NOK”,
“data”: false,
“error”: “NOT ALLOWED”
},
“excludedList”: “”,
“excludedListPickups”: ,
“gripLocations”: ,
“gripTimes”: ,
“gripRoutes”:
},
“ophaaldagen”: {
“response”: “NOK”,
“data”: ,
“error”: “No dataa”
},
“ophaaldagenNext”: {
“response”: “NOK”,
“data”: ,
“error”: “No data”
},
“afroepData”: {
“response”: “NOK”,
“data”: {
“afroepEmail”: “”,
“afroepContainers”: ,
“afroep”:
},
“error”: “”
},
“mededelingen”: {
“response”: “NOK”,
“data”: ,
“error”: “Error. No mededelingen found in db”
},

Suspect there is something wrong on the host side - if someone perhaps knows some who has contact details to reach the developers - please help!

Thanks a lot for this custom_component. However, upon starting Home Assistant, I always get this error:

Template error: as_timestamp got invalid input ‘geen’ when rendering template ‘{{ as_timestamp(states(‘sensor.afvalwijzer_pmd’)) | timestamp_custom(’%A’) }}’ but no default was specified

Any suggestion on how to fix this?

yes, read the error and do as it suggests. add a default value

I understand, but I did not define the template. It is part of the custom_component and I don’t know where to look. Hence the question here.

how is the template part of a custom component? which is that, and where is the template defined?

btw try this format

{{states('sensor.afvalwijzer_gft')|as_timestamp | timestamp_custom('%A') }}

It is the custom component this thread belongs to in which a number of sensors are created and for some of them a template appears to be used without specified default.

yes but the templates are not made by the component. ha just provides data, and several sensors

the templates are made by the user, to the needs of the user.

which and where. please be specific so we can see your problem and help out

btw since these sensors are timestamps already you can do

{{(states('sensor.afvalwijzer_gft')|as_datetime).strftime('%A')}}

and

{{(states('sensor.afvalwijzer_gft')|as_datetime).day}}

or

{{states('sensor.afvalwijzer_gft')|as_timestamp | timestamp_custom('%A') }}
{{(states('sensor.afvalwijzer_gft')|as_datetime).strftime('%A')}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).day}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).second}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).minute}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).hour}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).month}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).weekday()}}
{{(states('sensor.afvalwijzer_gft')|as_datetime).isoweekday()}}
{{time_until(states('sensor.afvalwijzer_plastic')|as_datetime)}}

:wink:

Thanks a lot for your help @Mariusthvdb.

I understand the question and the location where these are defined is exactly what I have been looking for myself.

I checked my complete config and I am sure that I have not defined these templates myself and that they somehow are a native part of the custom component.

I’ve been trying to go through the code myself and it appears to be related to the default_label: that is used by the custom component to replace the sensor value in case of no trash pick-up required.

Hence my question here. I was hoping that the author of the custom component or someone else that use the custom component could point me in the right direction.