Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95419

Icon color based on value range

$
0
0

@a94marbo wrote:

I have 2 sensors,
One sensor for current hourly power price ($/kWh). (sensor.power_prize)
One statistical sensor based on the latest 24 hour vales of “sensor.power_prize”, called “sensor.stat_power_price”. I.e. I have the max and min values of sensor.power_prize.

I am struggling in writing the correct code for assigning color to the icon of sensor.power_prize based on the value of sensor.power_prize and its relation to its max and min values given by sensor.stat_power_price.

green color = between (min value) and (min value+25%)
orange color = between (min value+25%) and (max value -25%)
red color: between (max value-25%) and (max value)

Any ideas about the correct syntax?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>