Changing Color of Card Icon/Text based on CPU Temperature (simple way)

Hi,

(I’m quite new to Home Assistant in general and especially new to/overwhelmed by the complexity of the frontend part, so please excuse me if I’m using wrong terms or mixing things up. thanks :slight_smile:)

I would like to set the color of the icon and/or text of a card according to the CPU Temperature of the HA Host (Raspi), based on this simple example:

I tried several things, but unfortunately I just can’t figure it out (fully).
(I also had a look at templates at some point, since it looked like this would be the solution, but I couldn’t even figure out how to translate “the old way of things” into templates, at least the last line of the example code used and decided this is a dead end anyway for my use case. Please let me know if this is wrong.)

What I achieved so far is one entity showing the sensor value and another one with switching icon color and switching (predefined) text values, based on a thresholdsensor helper.
But not all-in-one :slight_smile:

Screenshot 2024-02-20 000843

The first line is the sensor from the mentioned Command line Sensor example.
(The second line is the CPU Temp value from the System Monitor integration, which I checked out as well.)
And the third line is the mentioned threshold sensor helper.

Below the same when it’s “triggered”.
(I have set the threshold for this one to 30 to show the difference.)

Screenshot 2024-02-20 000910

So I want to achieve that the icon of the first line is switching to red color (or even to another icon in red) and/or the color of the text value (xx.x °C)
and get rid of the helper in the third line.

I found a lot of similar topics, but nothing is actually fitting my rather simple needs, isn’t too complex for my scenario/skill level or isn’t suspected to be outdated information.

I would really prefer/appreciate to know your opinion on the most basic/simple approach to this, also for learning purposes. Any hints are appreciated. Thanks!!

Examples I found on the way: