UI icon indicating copy to clipboard operation
UI copied to clipboard

Documentation for afvalophaling card

Open langestefan opened this issue 2 years ago • 10 comments

Hi. I would like to use the following card: Custom-card "Afvalophaling"

However I can't figure out what formatting I need to have on my garbage sensors. I use afvalbeheer already as required. I currently have it set to YYYY-MM-DD but this doesn't work with the card, as seen below:

image

Can the formatting requirement please be added explicitly to the documentation?

langestefan avatar Mar 23 '22 15:03 langestefan

I have similar issues with the card. It currently shows nothing... So no 'Volgende ophalingen' visualisation.

Would be nice to know the required config section for the sensor. Seems the date format should be %d-$m as stated here https://github.com/UI-Lovelace-Minimalist/UI/issues/475#issuecomment-1054195502 And the template looks for the word 'Geen' so the config for dutch should be 1.

Things that are not really documented for the moment.

My current config:

- platform: afvalbeheer
  wastecollector: RecycleApp
  resources:
    - restafval
    - papier
    - pmd
    - plastic
  postcode: !secret home_zipcode
  streetname: !secret home_street
  streetnumber: !secret home_number
  upcomingsensor: 1
  dateformat: "%d-%m"
  dutch: 1

Depechie avatar Apr 15 '22 12:04 Depechie

To fix the problem @langestefan shows in his screenshot... Not having a title. There are 3 variables for the card that are only definied in the NL.yaml file. So they need to be added to the languages.yaml file too ( somehow adding them to the EN.yaml has no effect... NO IDEA WHY )

I guess the custom card needs some revision.

    ulm_ophaling: "Trash collection!"
    ulm_geen_ophaling: "No collection"
    ulm_volgende_ophaling: "Next collection"

Screenshot (173)

Hmm not sure why but I do not see this languages.yaml file in the repo code itself?

Depechie avatar Apr 19 '22 08:04 Depechie

Maybe @Tommatheussen can help a bit here?

Depechie avatar Apr 19 '22 14:04 Depechie

translations for custom cards need to be added into the same folder structure as the code for the custom card like so: image I agree documentation is lacking a bit, it does look like my latest changes to the documentation for this card have been reverted, I'll need to look into why. This configuration for the integration works perfectly for me:

platform: afvalbeheer
wastecollector: recycleapp
resources:
  - restafval
  - papier
  - pmd
postcode: x
streetnumber: x
streetname: x
upcomingsensor: 1
dateformat: '%-d %B'
dutch: 1

The dateformat actually can be any format you want, that's just how it'll be shown in the UI, I don't think there's any check done on the dateformat itself.

Tommatheussen avatar Apr 19 '22 15:04 Tommatheussen

Thx @Tommatheussen for some details… I thought I texted the translation file but will try again ( I want to have EN.yaml ).

Depechie avatar Apr 19 '22 15:04 Depechie

Ok! Placing an en.yaml file with following structure now enables a title for the card!

---
ulm_language_variables:
  variables:
    ulm_ophaling: "Trash collection!"
    ulm_geen_ophaling: "No collection"
    ulm_volgende_ophaling: "Next collection"

Depechie avatar Apr 19 '22 20:04 Depechie

Hi all, I am quite a newbie to programming and Home Assistant, but eager to learn! Based on the instructions of @EverythingSmartHome I am trying to build my own dashboard, and also want to have the afvalophaling custom card by @AndyVRD . I have the addon from pippyn installed.

I have the same issue as @langestefan With the instructions above, I have been able to get the following: Afvalophaling

However, I cannot get the "Vandaag"("Today") or "Morgen" ("Tomorrow") text before the "GFT" text.

Below the input in my configuration.yaml file: sensor: - platform: afvalbeheer wastecollector: mijnafvalwijzer resources: - restafval - gft - papier - pmd postcode: hidden streetnumber: hidden upcomingsensor: 1 dutch: 1 dateformat: '%-d %B'

Below the code in my "House" view: (Sorry I did not put it in "code" format, but also on github I am a newbie. I am able to quote single lines as code, but not the code as a whole. Any tips?)

House Yaml

Any help is very much appreciated!

Alcarecco avatar Jun 04 '22 07:06 Alcarecco

In the meantime someone updated my code and to be honest i have not checked or tested these changes because my original code still works fine for my personal use. Maybe you can try to use my original code and see if that works for you. To be sure your integration configuration is correct i will share mine.

PS: You can create fenced code blocks by placing triple backticks ``` before and after the code block. You can find some info about that here.

    wastecollector: ""
    resources:
      - restafval
      - gft
      - papier
      - pmd
    streetname: ""
    cityname: ""
    postcode: ""
    streetnumber: 8
    upcomingsensor: 1
    dateformat: '%d-%m'
    dateonly: 1
    dateobject: 0
    name: Afvalophaling
    nameprefix: 1
    builtinicons: 0
    disableicons: 0
    dutch: 1

AndyVRD avatar Jun 06 '22 18:06 AndyVRD

Thanx for your input! I am gonna try some more. And thanks for the tip on how to create fenced coding blocks. I finally understand :-)

Alcarecco avatar Jun 07 '22 19:06 Alcarecco

I might be misunderstanding how the translation files work. When I added this custom card through the built-in configuration menu of Minimalist, it seems the 6 if statements in the custom-card code check the entity state for the collection_today and collection_tomorrow sensors of pippyn's integration using a Dutch string. See below example.

(variables.ulm_card_ophaling_vandaag && states[variables.ulm_card_ophaling_vandaag].state !== 'Geen')

This issue results in the future collection functionality of the custom-card not working, since it will never pass these if statements. When the entity state string in the cutom-card code is manually changed from "Geen" to "None", it functions just fine. The custom-card didn't come with any translation file when I downloaded it or at least this seems to have slipped past. Am I missing something that I'm meant to do here or is this just a bug?

TheDescender avatar Jul 27 '23 02:07 TheDescender