Can someone help me out with this. I want a red background with yellow open garage icon if my tilt sensor is "up" and a black background w blue color closed garage icon if closed. Here is my YAML (which I adit, I dont fully understand). Thanks.
type: custom:button-card
entity: binary_sensor.2_garage_tilt_sensor_third_reality_opening
show_state: true
name: Garage
styles:
card:
- height: 100px
- width: 100px
- background-color: |
[[[
if (states['binary_sensor.2_garage_tilt_sensor_third_reality_opening'].state == 'open')
return 'red';
if (states['binary_sensor.2_garage_tilt_sensor_third_reality_opening'].state == 'closed')
return 'black';
]]]