amaximus / garbage-collection-card

Custom Lovelace card for Garbage Collection custom component
MIT License
127 stars 24 forks source link

"in 6 days" or "Due Today" without 'date' showing #104

Closed danielbrunt57 closed 1 year ago

danielbrunt57 commented 1 year ago

Describe the bug Please fix the logic for

    hide_date: true|false
    hide_days: true|false

so I can see "in 6 days" or "Due Today" without it showing the date.

image

amaximus commented 1 year ago

I think it works as expected. Could you please double-check and get back to me with results?

danielbrunt57 commented 1 year ago

I don't think so. While it may be as expected it is not as I desire! I have to have hide_date: false to see "Due Today" but if I set garbage the same way I see the date... image

image

danielbrunt57 commented 1 year ago

Basically, I would like hide_date to hide 02/07/2023 but not Due today. Due today should be the same as in 6 days and not considered as date? Or Due Today is displayed when days=0? Date should just be a date and days is in 5 days | in 2 days | Due tomorrow | Due today

amaximus commented 1 year ago

If you want 'due today/tomorrow' instead of 'in 0/1 days' then set due_txt: true. That will overwrite hide_date and hide_days when due day is today or tomorrow. Otherwise hide_days and hide_date manipulate what are displayed. So you should have:

due_txt: true
hide_date: true
hide_days: false

(the last one can be left out as it's the default value.

amaximus commented 1 year ago

You may check the example from: https://github.com/amaximus/garbage-collection-card/issues/103#issuecomment-1413358970

danielbrunt57 commented 1 year ago

due_text only displays when true if hide_date is false...

image

image

image

I want to hide the date portion of "01/07/2023 in 6 days" so it says "in 6 days" and when sensor state is 0 or 1, I want it to display "Today" or "Tomorrow"...

danielbrunt57 commented 1 year ago

If you want 'due today/tomorrow' instead of 'in 0/1 days' then set due_txt: true.

I have never seen "in 0 days" or "in 1 day". I have tried false,false,false, true,false,false, false,true,false, false,false,true, true,true,false, true,false,true, false,true,true and true,true,true!

The only way I get "in [2:6] days" is with true,true,false or false,true,false. But when days is 0 or 1 it never says "in 0|1 day(s)".
Instead, it says either "Today|Tomorrow" or "Due Today|Due Tomorrow" but only when hide_date is false and that will reveal the date "02/07/2023" when days is 6.

amaximus commented 1 year ago

due_txt only controls what it is displayed when the collection is due today or tomorrow (the sensor has a state value of 0 or 1). Otherwise it doesn't have any effect. In a setup like this:

      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_tue
        icon_color: green
        icon_size: 35px
        hide_date: true
        hide_days: false
        due_txt: true
        details_size: 12px
        hass_lang_priority: true
:
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_fri
        icon_size: 35px
        hide_date: true
        hide_days: false
        due_txt: true
        due_color: blue
        due_1_color: brown
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_sat
        icon_size: 35px
        hide_date: true
        hide_days: false
        due_txt: false
        due_color: blue
        due_1_color: brown

you get the following for Tue, Fri and Sat: garbage

danielbrunt57 commented 1 year ago

So are you saying with 1 sensor state and 1 static card configuration that I cannot achieve... "in 3 days" "in 2 days" "Tomorrow" "Today" "in 6 days" ??

danielbrunt57 commented 1 year ago

Your test example is difficult to comprehend...

amaximus commented 1 year ago

Please set:

hide_date: true
hide_days: false
due_txt: true

for your garbage cards and make sure you reload from server (shift-reload) the card. Please also make sure you are using the latest version of the card (1.22.4).

danielbrunt57 commented 1 year ago

Those were my settings for the card. I was running 1.22.3 but no notification of update for 1.22.4. I issued a re-download in HACS and now have 1.22.4. I have manually set/override sensor state/days in Dev Tools and can confirm it is now working as I desire.

image

image

Obviously, you found an error in the logic and corrected it. Thank you!!!

danielbrunt57 commented 1 year ago

image

danielbrunt57 commented 1 year ago

I supported your efforts! https://www.buymeacoffee.com/6rF5cQl

Thanks again! -Daniel