amaximus / garbage-collection-card

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

Hide Date Doesn't Hide the Date #35

Closed codypet closed 4 years ago

codypet commented 4 years ago

I'm able to hide the card per the documentation, but when I go to hide the date, nothing happens. I'm not sure what could be wrong. Everything else works just fine.

entity: sensor.trash
hide_date: true
hide_before: 2
icon_size: 40px
type: 'custom:garbage-collection-card`
amaximus commented 4 years ago

Tried to reproduce with the following entry in ui-lovelace.yaml:

      - type: custom:garbage-collection-card
        entity: sensor.test_garbage_every_tue
        icon_color: yellow
        icon_size: 35px
        hide_date: true
        hide_before: 2

but I didn't succeed, meaning the card worked as expected. You may try to clean the browser cache. If that doesn't fix it, please post the configuration of the sensor.trash. screenshot-hide_date

codypet commented 4 years ago

Clearing cache didn't seem to fix anything. Since the migration to 0.110, the icon doesn't show up either.

entity: sensor.recycling icon_color: green icon_size: 35px type: 'custom:garbage-collection-card'

entity: sensor.recycling icon_color: green icon_size: 35px type: 'custom:garbage-collection-card'

Here is the configuration

garbage_collection: sensors:

  • name: "Trash" frequency: "weekly" collection_days:
    • tue exclude_dates:
    • '2019-12-25' verbose_state: True
  • name: "Recycling" frequency: "weekly" icon_normal: mdi:recycle collection_days:
    • fri exclude_dates:
    • '2019-12-25' verbose_state: True
amaximus commented 4 years ago

Could you please make sure you upgrade to the newest version of the card (1.5.6)? The disappearing icon issue was fixed in 1.5.5. Based on your card definition above you should also add 'hide_date: true' to your cards' definition.

codypet commented 4 years ago

I am running 1.5.6

Also I was confused at which Lovelace view wasn't hiding the date. Here is the configuration of the card that I was intending to have hide the date. As you can see below, it still doesn't hide the date.

cards:

  • entity: sensor.trash hide_date: true icon_size: 40px type: 'custom:garbage-collection-card'
  • entity: sensor.recycling hide_before: 2 hide_date: true icon_color: green icon_size: 40px type: 'custom:garbage-collection-card'

image

amaximus commented 4 years ago

Could you please put type as first element and then entity, etc.

codypet commented 4 years ago

Same issue. Though icons did come back after refreshing.

  - type: 'custom:garbage-collection-card'
    entity: sensor.trash
    hide_date: true
    icon_size: 40px
  - type: 'custom:garbage-collection-card'
    entity: sensor.recycling
    hide_before: 2
    hide_date: true
    icon_color: green
    icon_size: 40px

image

amaximus commented 4 years ago

The issue is the verbose_state=true in the sensor definition. This makes the state of the sensor be a predefined string (can be overwitten by verbose_format). In such case the card doesn't overwrite this string as the card can hide elements if the state of the card is a number (when verbose_state is false). So if there is no reason for having verbose_state=true simply set it to false, otherwise you can use the verbose_format of the sensor to control what to display.

amaximus commented 4 years ago

Any updates on this issue? Did you manage to change the verbose_state to false so use the card config to hide the date or to leave verbose_state=true and control the message to display via the verbose_format of the senson?

codypet commented 4 years ago

Sorry I just saw this. I wanted the verbose state to show up for my desktop cards, but not the mobile cards. Won't setting the verbose_state=false remove the messaging on the desktop versions of my lovelace?

amaximus commented 4 years ago

Setting verbose_state=false will cause the state of the sensor to be a number (0: today, 1: tomorrow, 2: the rest) thus you may control what is displayed via my custom card (that takes the data from the sensor attributes in this case). If verbose_state=true the sensors state will be a string controlled by verboseformat of the sensor. The card will not modify this and will display that string as-is (thus hide* parameters will be discarded).