Using the custom button card and a sensor group I set up (the value of which is working fine in an automation) I want to test the value for colouring the name text on the button. I have used this custom card method several times in the past on ‘on’ and ‘open’ so all I think I am missing is the correct language required to test the value. The error I get is that the button is invisible, while still taking up space. The actual current value is 24.6
type: custom:button-card
name: Batteries
icon: none
hold_action:
action: none
tap_action:
action: navigate
navigation_path: /dashboard-main/batteries
show_state: false
show_icon: false
show_name: true
styles:
name:
- padding: 10px 10px
- color: |
[[[
if ((states["sensor.batterywarning"].numeric_state < 25.0))
return 'red'
]]]
layout_options:
grid_columns: 2
grid_rows: 1
1 post - 1 participant