I have a countdown entity (from the anniversaries integration https://github.com/pinkywafer/Anniversaries ) which is currently at 27.
If I do this it correctly colors the icon darkorange:
- entity: sensor.anniversary_lucy_s_birthday
name: Lucy's Birthday
show_icon: true
show_state: true
state_color: true
tap_action:
action: default
hold_action:
action: default
icon:
conditions:
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 27
styles:
'--card-mod-icon-color': darkorange
However, if i try to make it a numeric_value below 30 it doesn’t work:
- entity: sensor.anniversary_lucy_s_birthday
name: Lucy's Birthday
show_icon: true
show_state: true
state_color: true
tap_action:
action: default
hold_action:
action: default
icon:
conditions:
- condition: numeric_state
entity_id: sensor.anniversary_lucy_s_birthday
below: 30
icon_color: darkorange
styles:
'--card-mod-icon-color': darkorange
Any clue why this isn’t working? Where am I going wrong?
Sorry about that - first time posting on here
I managed to both it with an or condition but would love to hear if anyone has a better solution!
- entity: sensor.anniversary_lucy_s_birthday
name: Lucy's Birthday
show_icon: true
show_state: true
state_color: true
tap_action:
action: default
hold_action:
action: default
icon:
condition: or
conditions:
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 28
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 27
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 26
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 25
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 24
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 23
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 22
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 21
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 20
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 19
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 18
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 17
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 16
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 15
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 14
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 13
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 12
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 11
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 10
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 9
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 8
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 7
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 6
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 5
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 4
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 3
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 2
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 1
styles:
'--card-mod-icon-color': darkorange
- condition: equals
entity_id: sensor.anniversary_lucy_s_birthday
value: 0
styles:
'--card-mod-icon-color': darkorange
Troon
(Troon)
June 8, 2023, 9:56am
5
What type of card is this?
I’m actually using a ‘room card’:
pkscout
(Kyle Johnson)
June 8, 2023, 10:26am
7
There’s a support thread for that card. You can probably get an answer there to your question.
So I made my own card, used another custom card as an example and made it my own.
Tell me what you think!
And if you see improvement, please let me know!
Troon
(Troon)
June 8, 2023, 10:27am
8
OK, so:
suggests this should work, if your original equals
works, and it looks like you don’t have to reference the entity if it’s the same one as the rest of the config:
icon:
conditions:
- condition: below
value: 30
icon_color: darkorange
styles:
'--card-mod-icon-color': darkorange
You can’t assume the automation / script syntax (e.g. numeric_state
) in the HA core carries across to frontend projects automatically.
1 Like
YES! Thank you so much for that. It appears to work perfectly
1 Like