I have spent ages on this & must be being really daft.
At the most basic level trying to set the colour of a Gauge (have the severity off, no use for me)
card-mod working OK, tested code at bottom of this post.
Basically I have solar power coming in & charging the battery, the battery Watts are always positive but there is a separate identity that is 1 for charging & 0 for flowing from the battery.
I would like the power gauge to be green when charging & red when flowing away.
I think I found some code to test & might work but I can’t even change the colour perminantly.
It is always blue.
Ideally if someone could advise how to change the colour but also to code for testing for 1 or 0 & set the colour accordingly.
this is a very basic code but tried hundreds of variations.
type: vertical-stack
cards:
- type: gauge
entity: sensor.solis_battery_power
card_mod:
style: |
ha-card {
color: green;
}
This works OK ...
type: markdown
content: '## Hello'
card_mod:
style: |
ha-card {
color: red;
background: transparent;
text-align: center;
}