Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106802

[custom:button-card] Card Color based on entity attribute

$
0
0

I’m currently using the Garbage-Collection & button-card to display which bin is due and when.

This has been great so far but due to the UK being so awkward the times they’re collected vary.

image

(Day before & flashes on the day)
image

I’m not too great with the language at the moment … but ideally I’m looking to have a little more warning days before

greater than 3 days = dark
2 and 3 days = highlight
1 day before & the day = highlight and flash

image

type: 'custom:button-card'
entity: sensor.grey_bin
label: |
  [[[
    var bri = states['sensor.grey_bin'].attributes.days;
    return '' + (bri ? bri : '0') + ' Days';
  ]]]
icon: 'mdi:trash-can'
name: GREY
styles:
  card:
    - height: 80px
  label:
    - color: gray
    - font-size: 12px
    - padding: 0px 5px
  name:
    - text-transform: uppercase
    - font-familly: cursive
    - justify-self: centre
    - padding: 0px 7px
    - font-size: 15px
tap_action:
  action: more-info
  service_data:
    entity_id: sensor.grey_bin
show_state: false
show_label: true
state:
  - value: '0'
    color: 'rgb(222, 37, 16)'
    styles:
      card:
        - animation: blink 2s ease infinite
  - value: '1'
    color: 'rgb(222, 95, 16)'
    icon: 'mdi:delete-circle-outline'
  - value: '2'
    color: 'rgb(145, 145, 145)'
    icon: 'mdi:delete-circle'

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>