Layout for garbage_collection sensor

Right so that helped a little. :slight_smile:

I opened my Lovelace and edited it. I paste this exactly into it and get the following when I hit save. Line 757 in the exception the ‘cards’ line below. I have tried to mess with the spacing etc and no dice. Man I am missing something here, but made progress. I am a novice and I apologise.

Unable to parse YAML: YAMLException: bad indentation of a sequence entry at line 757, column 5: cards: ^

resources:
  - {type: js, url: ‘/local/community/garbage-collection-card/garbage-collection-card.js’}
    cards:
      - type: custom:garbage-collection-card
        entity: sensor.glass_recycling
        icon_size: 35px
        icon_color: green
        hide_date: true
      - type: custom:garbage-collection-card
        entity: sensor.rubbish
        hide_before: 4
        icon_color: '#0561ba'

You’ll have to get familiar with YAML and its indentation. At this point the custom card is found but it cannot display it as the the YAML indentation in your Lovelace is wrong.
Try to put it under another card having thus the indentation of the garbage collection card aligned from indentation point of view with the other card.

I had a lot of difficulties in formating yaml correctly also. What helped me was reading:

http://thomasloven.com/blog/2018/08/YAML-For-Nonprogrammers/

and a discussion I had with petro in this forum.

https://community.home-assistant.io/t/lovelace-button-card/65981/3286

Look at April 1 and follow our discussion. I believe if someone could capture this in a document it would help a lot of new users.

Also the more you practice, the more you will get the hang of it. Most people just cut and paste code they see and not understand how the format should look.
Good Luck.

Thank you both. I will read these docs. I am very aware that it needs to be correctly formatted and so I paid close attention, however it would appear that I have missed something.

I will let you know if i get it.

OK so I totally get the importance of formatting and I have read over posts and I really appreciate your help so far guys! I have fiddled with the formatting as best I can and hope I have it right now. I took your advice Atticus and put in in another Lovelace UI. However:

I have taken a screen shot of part of the .yaml. below. This includes a little of the bit above. I am now getting this: Unable to parse YAML: YAMLException: duplicated mapping key at line 757, column -293: cards: ^

The resources don’t belong where you put it. I have a sperate yaml file for all my custom card’s resources. This is documented and I’ll try and send it to you shortly.

Thanks Bill. I look forward to that.

Just one other thing Bill. I installed all this following the instructions here

I used HACS. It installs under Lovelave UI resources the card. This is what I am finding so hard to understand. Most others stuff in HA I have got after a bit of Googling and fiddling.

So When I look under the resources tab you can see the what is below. I am finding it hard to understand why I need to add further resources when the.js appear to be already there. I have no idea how to edit or see it, but it is there.

PS it has been there all along

You don’t. When you install with HACS, the installation installs the resource in the correct location. I think you are confusing how to use the resource? Once I install different HACS stuff I honestly forget about them (until a system change causes you to move them :slight_smile:, happened several months ago). It is not used in the Lovelace card. Are you not understanding how to make the card, how the integration works or something else. Once you have the integration installed there are many options on showing your garbage collection sensor. If you need, I can give you samples or search the forums. There are many examples.

Hi Bill. I just saw your response, thanks. I have installed via HACS the card and the integration. I am simply now trying to create a card to work in Lovelace. That is the whole issue.

Below is my lovelace card. When I try to create the card I get ‘Custom element doesn’t exist: garbage-collection-card’

Happy to do this via PM and happy to buy you several coffees fort your time!

cards:
  - entity: sensor.rubbish
    hide_date: true
    icon_color: green
    icon_size: 35px
    type: 'custom:garbage-collection-card'
  - entity: sensor.mixed_recycling
    hide_before: 4
    icon_color: '#0561ba'
    type: 'custom:garbage-collection-card'
type: 'custom:garbage-collection-card'

No coffee is needed. I’ll try and help you where I can. This is mine.

 -
    cards:
      - entity: sensor.trash
        icon_color: brown
        icon_size: 35px
        type: 'custom:garbage-collection-card'
      - entity: sensor.yard_waste_2
        icon_color: green
        icon_size: 35px
        type: 'custom:garbage-collection-card'  
      - entity: sensor.recycle
        icon_color: blue
        icon_size: 35px
        type: 'custom:garbage-collection-card'  
      - entity: sensor.branches
        icon_color: green
        icon_size: 35px
        type: 'custom:garbage-collection-card'
    type: vertical-stack

I don’t think you can stack custom:garbage-collection-card in custom garbage-collection-card?
My advice is try one item. When it works, then start with different types of stacks. I am using yaml mode, so my code may look a little different.

Thanks so much for sharing. Same problem exits.

Should I try uninstalling and reinstalling the garbage collection card?

When I started with custom card’s I got this a lot. Every “doesn’t exist” was always due to my formating errors in yaml. Not understanding how editing is done inside HA depending on where you were doing it was a big problem for me. When I learn about spiting my yaml file and using different loading tecniques forced me to learn how dictionaries and lists work. I stopped using the UI editor to be consistent. I use yaml mode so all of my cards look the same when I edit them. Do you have any other custom cards that work? If so copy the code using the raw editor in another editor (i.e notepad ++) and then copy this code and do a line by line comparison.

Thanks Bill. I thought I had already done this but i uninstalled, restarted HA and installed again and wait for it. IT WORKED!!!

I am fairly used to .yaml these days and realise the formatting is super important. I am however trying to move with the times and the way HA are pushing us I guess and that is the visual editor.

I want to thank you for your patience.

One other thing. What code do I have to add to make the colours change when its due, like tomorrow. Do you use this or just use the date?

I don’t do anything fancy with the icons. Do a search on the forums. There are a lot of people that are very creative.

Yep. Just found that. Thanks again Bill I appropriate your help :slight_smile:

1 Like

Can anyone help me with an automation using this garbage collection sensor? I’m trying to trigger an event (in this case an announcement) that uses the sensor states in the documentation (value 1 according to the documentation, is the ‘tomorrow’ state of the sensor), so that the event gets triggered the day before the garbage collection is due.

However, using State as a condition and using value 1 doesn’t appear to work and I think it might be because of this condition not working as it should. Any ideas?

- 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

Just confirming this is the correct change for v3.02:

  # - name: "Recycling" # Bi-weekly, old config
  #   frequency: "odd-weeks"
  #   collection_days: "mon"
  - name: "Recycling" # Bi-weekly, new config
    frequency: "every-n-days"
    period: 14
    first_date: '2020-07-13'

Hi Guys,

I would like to integrate the following:

grafik

I have an ICS file where the times for the garbage collection are entered. Can I insert the ics file somehow

Sorry for my really good englisch :smile:

And how to config the language even if it´s just today and tomorrow? I can find the language file, but then?