amaximus / garbage-collection-card

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

Pick-up due tomorrow now shows 'Tomorrow 1' #103

Closed Scoff123 closed 1 year ago

Scoff123 commented 1 year ago

I've just noticed that because our recycling and refuse are both due for pick-up tomorrow, although my card is correctly showing my 'due_1_color', instead of just showing the due_txt of 'Tomorrow' like it normally does, it shows 'Tomorrow 1' therefore it appears to be including the state of my sensor.recycling (which has a current state of 1) as well as the due_txt?

I am running version 1.22.2 of the card, and Home Assistant 2023.1.7 Supervisor 2023.01.1 Operating System 9.4 Frontend 20230110.0 - latest

My card code:

type: custom:garbage-collection-card
entity: sensor.recycling
icon_color: green
icon_size: 35px
due_color: red
due_1_color: yellow
due_text: false
hide_on_click: false
amaximus commented 1 year ago

Could you please provide a snapshot on sensor.recycling from Developer Tools -> States where I can see the sensor state and its attributes. Thanks.

Scoff123 commented 1 year ago

Sure thing, here you go:

image

My second sensor is also showing 'Tomorrow 1' and here is the state of that one:

image

My 3rd sensor is actually showing correctly, but that one isn't due for pick up for 2 days, however it correctly shows: 02/02/2023 in 2 days as the due_txt. Here is the state of that sensor:

image

and a snapshot of how all 3 currently show:

image
Scoff123 commented 1 year ago

Just to add to this - as of today, the card now shows as follows:

image
amaximus commented 1 year ago

Thanks. I found the error, I'll fix it later today.

Scoff123 commented 1 year ago

Great, thank you 👍

amaximus commented 1 year ago

I pushed a release (1.22.3) fixing this issue. Please update the card and get back to me with results.

I saw that you are using due_txt: false. Please note that this will make the normal "date in [1|2] days" displayed when due date is today or tomorrow. To have 'Today' and 'Tomorrow' displayed please use due_txt: true

Scoff123 commented 1 year ago

Thanks. I've downloaded 1.22.3 and reloaded, cleared browser cache and even restarted HA, however nothing seems to have changed - the card is still displaying exactly as it was before. I've tried deleting the card and creating it fresh, and re-downloading the new version a second time, but nothing looks any different with the card? Also, changing between due_txt: false and due_txt: true makes no difference to the appearance of the due text strangely?

My full card config:

type: vertical-stack
cards:
  - type: custom:garbage-collection-card
    entity: sensor.recycling
    icon_color: green
    icon_size: 35px
    due_color: red
    due_1_color: yellow
    due_text: true
    hide_on_click: false
  - type: custom:garbage-collection-card
    entity: sensor.big_bin
    icon_color: grey
    icon_size: 35px
    due_color: red
    due_1_color: yellow
    due_text: true
    hide_on_click: false
  - type: custom:garbage-collection-card
    entity: sensor.garden_waste
    icon_color: green
    icon_size: 35px
    due_color: red
    due_1_color: yellow
    due_text: true
    hide_on_click: false

and current display using 1.22.3

image
amaximus commented 1 year ago

Could you please do a refresh from the server (shift F5)?

Scoff123 commented 1 year ago

Yes I've tried that, and tried viewing my dashboard on multiple different devices, however the card is still showing the same.

amaximus commented 1 year ago

There must be something wrong with you UI/browser cache/whatever. In my test envirnment the following configuration gives the right result:

      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_mon_v
        icon_color: green
        icon_size: 25px
        hide_days: true
        due_1_color: brown
        hide_on_today: true
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_tue
        icon_color: green
        icon_size: 35px
        hide_date: true
        hide_days: false
        details_size: 12px
        hass_lang_priority: true
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_wed
        icon_size: 35px
        hide_date: true
        hide_days: true
        due_txt: true
        details_size: 8px
        due_1_color: brown
        due_color: red
        hide_on_today: true
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_thu
        icon_color: yellow
        icon_size: 35px
        hide_date: false
        hide_days: true
        due_txt: false
        due_1_color: brown
        due_color: red
        hide_on_click: false
      - 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: false
        hide_days: false
        due_txt: false
        due_color: blue
        due_1_color: brown
      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_sun
        icon_color: black
        icon_size: 35px
        hide_date: false
        hide_days: true
        due_txt: true

garbage

Scoff123 commented 1 year ago

How strange, thanks for confirming though. I could understand a caching/browser issue if it was only happening on one device or browser since updating to the new version of the card, but it's across all devices, even after a HA restart as well as a host server restart. I'll have to dig into it try and figure out what could be causing it. The due_color and due_1_color are both working correctly like they always have, so I'll have to try and see why updating to the newer version of the card doesn't seem to be having any effect, and also toggling between true and false for the due_txt when the sensors are in a state of 0 or 1 has no affect on what is displayed.

amaximus commented 1 year ago

It seems that your browser cache did not pick up the new version of the javascript script (the card). I do not know which browser are you using but for Chrome in the 'Clear browsing data' I select everything except for 'Cookies and other side data'. Sometimes the Refresh within HA UI also helps.

amaximus commented 1 year ago

Wait, my bad. Pushed the release with the old version, the file copy had a typo in it

amaximus commented 1 year ago

Pushed a new release with the new version of the card .

Sorry about that.

Please update the card and get back to me with results.

Scoff123 commented 1 year ago

It's working correctly now with the new 1.22.4 version 👍 No problem, these things happen, thanks for getting that sorted!

image