Layout for garbage_collection sensor

I have installed the garbage_collection sensor using HACS. All works well as far as function.

What I want is to make it look like the example layout on the GitHub page

Tried using horizontal stack but this just pushes the date to the side and this doesn’t look great.

Any ideas

There is a Lovelace custom card for it: https://github.com/amaximus/garbage-collection-card

1 Like

This is great. Thanks

Hi @amaximus, is it possible to use the card without the garbage-collection platform? I have a webscraper that gives me my dates from a public service, but I really liked your card for presentation. thanks.

hi @tormagj, the garbage-collection-card expects sensor data including attributes as per garbage collection platform. Of course, if you have a sensor with the same attributes (names and value meaning the same as for the garbage collection platform) as provided by the garbage collection platform but fed from other source, it will work.

I am confused by the directions on the custom card. I have install both the custom card and the sensor via HACS. Not sure what goes into configuration.yalm, what goes into ui.lovelace and what goes in to the custom manual card.
Thanks

1 Like

You have to define the garbage collection sensor in your configuration.yaml (or in one of its includes).

The custom card configuration goes into the ui-lovelace.yaml.

Go it working with multiple integration. Did not work when I had it in the configuration.yaml file. Not sure why as the entities in the yaml file were seen by other cards just not the garbage card.

Is there a way to modify the code to use my own icons? How would I reference them in the code properly?

I have been using this component for a bit now and it’s great but I need notifications to remind me at times like before I leave for work or the night before. At what time does the sensor update and change from the Tomorrow (1) to the Today (0) states and can that be changed?

I would imagine it changes at midnight. You don’t need to change this as that’s how it knows today vs tomorrow. What you need to do is setup an automation that uses these states. For example, setup an automation where the trigger is time, set at say 20:00, then set a condition using the garbage sensor, with state set to 1. Then set the notification action to whatever you want (I use an Alexa voice announcement). This will action a notification at 8pm the night before that the garbage is being collected tomorrow and you should put it out.

Edit.

Like this:

- id: '1576837842795'
  alias: Refuse collection Alexa reminder announcement - Rubbish and garden waste
  description: ''
  trigger:
  - at: '20:00'
    platform: time
  condition:
  - condition: state
    entity_id: sensor.rubbish_garden
    state: '1'
  action:
  - data:
      data:
        type: tts
      message: Remember to put out the rubbish and garden waste wheely bins and the
        food waste tonight
    service: notify.alexa_media_andy_and_alison
1 Like

Yeah I realized this shortly after I posted this question and changed the way I was thinking of the automation. I was also worried that when I wanted to fire the automation would be too close to when it changed but you are right it changes at Midnight so I am all good.

Yeah, you are welcome!

@amaximus I’m using your card with a different Garbage sensor. Since this sensor does not provide all the attributes needed for your card, I’m adding them via

attribute_templates

I have it almost working, but the card won’t show the text ‘in xxx days’. So I’m wondering what I’m doing wrong.

Here’s my sensor

###########################################################
## ACV Afvalverwerking
###########################################################
- platform: acv
  postcode: !secret home_zipcode 
  housenumber: !secret home_housenumber
  resources:
    - grey
    - green

- platform: template
  sensors:
    date_paper:
      friendly_name: 'Papier'
      value_template: '{{ as_timestamp(strptime(states.sensor.afval_papier.attributes.date, "%Y-%m-%d")) | timestamp_custom("%d-%m-%y") }}'
      attribute_templates:
          next_date: >-
            {{ states.sensor.afval_papier.attributes. date }}
          verbose_state: >-
            'true'
          days: >-
            {{ ((  as_timestamp(strptime(states.sensor.afval_papier.attributes.date, "%Y-%m-%d")) - as_timestamp(now()) ) / 86400 ) | round(0) }}
    date_grey:
      friendly_name: 'Restafval'
      value_template: >-
        {{ as_timestamp(strptime(states.sensor.afval_rest.attributes.date, "%Y-%m-%d")) | timestamp_custom("%d-%m-%y") }}
      attribute_templates:
          next_date: >-
            {{ states.sensor.afval_rest.attributes. date }}
          verbose_state: >-
            'true'
          days: >-
            {{ ((  as_timestamp(strptime(states.sensor.afval_rest.attributes.date, "%Y-%m-%d")) - as_timestamp(now()) ) / 86400 ) | round(0) }}

And here’s the config for the card

      - entities:
      - entities:
        - type: custom:garbage-collection-card
          entity: sensor.date_grey
          icon_size: 35px
          icon_color: green
          hide_date: false
          hide_before: 4
        - type: custom:garbage-collection-card
          entity: sensor.date_green
          icon_size: 35px
          icon_color: green
          hide_date: false
          hide_before: 4

Finally, this is what I’m seeing:
image

Hope you can help.

@Djiest since you use verbose_state=true, hide_days and hide_date are discarded, the text defined by verbose_format (of the garbage_collection platform) should be diplayed. At verbose_state=true, the card will set hide_days to true, hide_date to false and will try to reuse and populate hide_date with the status value of the sensor (which in the case of verbose_state=true is set to the value of verbose_format).

Try to define a value template with the text you want to be displayed (not only the date).

@amaximus thanks for the feedback. I have now edited the tempate as follows

    date_paper:
      friendly_name: 'Papier'
      value_template: '{{ as_timestamp(strptime(states.sensor.afval_papier.attributes.date, "%Y-%m-%d")) | timestamp_custom("%d-%m-%y") }}'
      attribute_templates:
          next_date: >-
            {{ states.sensor.afval_papier.attributes. date }}
          verbose_state: >-
            true
          verbose_format: >-
            in {{ ((  as_timestamp(strptime(states.sensor.afval_papier.attributes.date, "%Y-%m-%d")) - as_timestamp(now()) ) / 86400 ) | round(0) }} days
          days: >-
            {{ ((  as_timestamp(strptime(states.sensor.afval_papier.attributes.date, "%Y-%m-%d")) - as_timestamp(now()) ) / 86400 ) | round(0) }}

but the ‘verbose_format’ is still not shown.

@Djiest the verbose_format is only used by the garbage_collection custom component and in case of verbose_state=true it will set the state of the sensor to the text defined by that (instead of a numerical value).
The custom card does not use the verbose_format, so in case the state of the sensor is not a number (thus a text) the card will use that text in the hide_date.
Since you are using another source for garbage collection data you’ll have to set the state of the sensor (well the value_template) to whatever string you want to display.
There is no need to set the verbose_state and verbose_format for your sensor as tge card looks for the state of the sensor, whether it is a number or not. If it’s a number will look for the date and days attributes of the sensor, if it’s not a number, it will display the text that is the state of the sensor.

1 Like

Hello,
just starting with this sensor.
I added the schedules using the (recommeded) method by integration as described in the doc.
However, having a small issue when adding specific dates. It tells me to enter comma-seperated values, so i did, e.g.
05/08,09/22,11/03

"Then it tells me “entities does not exist”
I am understanding s.th. wrong?

Thanks in advance!

/ Ralf

Try entering the dates with this format:
2020-05-29,2020-09-11,2020-11-27

This is what works for my integration.

Nope, does not work for me - still showing same error…

EDIT: changed to YAML config, this works and i even can edit the specific dates better next year.

Anyway, thanks for your help!

/ Ralf