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

Customize template icon & color for a binary sensor (trend)

$
0
0

@csacre wrote:

Hi,

I try to have templates on color & icon for a binary sensor (trend one).
Based on several posts (eg: Need help with sensor icon color based on state) , I added the following in my customize.yaml and made many variation of it.
I confirm that the state is indeed “on” or “off” from dev tools.

But it does not work.

Any idea or suggestion for further investigation ?

binary_sensor.hall_temp_rising:
  templates:
    icon: "
      if (state === 'on')  return 'mdi:thermometer-chevron-up';
      if (state === 'off') return 'mdi:thermometer-chevron-down';
      return 'mdi:thermometer';"
    icon_color: "if (state === 'on') return 'rgb(255,0,55)'; return 'rgb(0,191,255)';"

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 106357

Trending Articles



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