{"id":1418,"date":"2023-02-14T16:59:47","date_gmt":"2023-02-14T21:59:47","guid":{"rendered":"https:\/\/www.ebnet.us\/?p=1418"},"modified":"2023-02-14T21:19:09","modified_gmt":"2023-02-15T02:19:09","slug":"home-assistant-how-to-change-icon-color-dynamically-with-config-template-card","status":"publish","type":"post","link":"https:\/\/www.ebnet.us\/index.php\/2023\/02\/14\/home-assistant-how-to-change-icon-color-dynamically-with-config-template-card\/","title":{"rendered":"Home Assistant: How to change Icon color dynamically with Config Template Card"},"content":{"rendered":"\n<p>For many sensors in <a href=\"https:\/\/www.home-assistant.io\/\" target=\"_blank\" rel=\"noopener\" title=\"\">Home Assistant<\/a> you may want to change icon color dynamically on your dashboard. Having the icon color turn on or off was not enough for me especially for thermostats. I wanted to use a range of colors to show how extremely cold or hot the temperature was. The way I accomplished this was by using the Config Template Card.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"470\" height=\"70\" src=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Front-Door-Temp-Green.png\" alt=\"\" class=\"wp-image-1419\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Front-Door-Temp-Green.png 470w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Front-Door-Temp-Green-300x45.png 300w\" sizes=\"auto, (max-width: 470px) 100vw, 470px\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"467\" height=\"71\" src=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Front-Door-Temp-Blue.png\" alt=\"\" class=\"wp-image-1423\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Front-Door-Temp-Blue.png 467w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Front-Door-Temp-Blue-300x46.png 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Installing the Config Template Card<\/h2>\n\n\n\n<p>Firstly you are going to need to install the Config Template Card. The easiest way is to use <a href=\"https:\/\/hacs.xyz\/\" target=\"_blank\" rel=\"noopener\" title=\"\">HACS<\/a><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"461\" height=\"190\" src=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Config-Template-Card.png\" alt=\"\" class=\"wp-image-1420\" srcset=\"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Config-Template-Card.png 461w, https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/HA-Config-Template-Card-300x124.png 300w\" sizes=\"auto, (max-width: 461px) 100vw, 461px\" \/><\/figure>\n<\/div>\n\n\n<p>Or you can install manually using this <a href=\"https:\/\/github.com\/thomasloven\/hass-config\/wiki\/Lovelace-Plugins\" target=\"_blank\" rel=\"noopener\" title=\"\">guide<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">YAML for dynamically changing icon color<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>type: custom:config-template-card\nvariables:\n  TEMP: states&#91;'sensor.blink_front_door_temperature'].state | i\nentities:\n  - sensor.blink_front_door_temperature\ncard:\n  type: custom:mushroom-entity-card\n  entity: sensor.blink_front_door_temperature\n  name: Front Door Temperature\n  icon_color: &gt;-\n    ${TEMP &lt; '0'? 'deep-purple' :TEMP &lt; '20'? 'purple' : TEMP &lt; '32' ? 'indigo'\n    : TEMP &lt; '50' ? 'blue': TEMP &lt; '72' ? 'green': TEMP &lt; '85' ? 'orange':\n    'red'}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>For many sensors in Home Assistant you may want to change icon color dynamically on your dashboard. Having the icon color turn on or off was not enough for me especially for thermostats. I wanted to use a range of colors to show how extremely cold or hot the temperature was. The way I accomplished&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1421,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[69,25],"tags":[71,70],"class_list":["post-1418","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-home-assistant","category-software","tag-dashboard","tag-home-assistant"],"featured_image_src":"https:\/\/www.ebnet.us\/wp-content\/uploads\/2023\/02\/Home_Assistant_Logo.svg_.png","author_info":{"display_name":"Ed Brandon","author_link":"https:\/\/www.ebnet.us\/index.php\/author\/bigeb\/"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts\/1418","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/comments?post=1418"}],"version-history":[{"count":2,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts\/1418\/revisions"}],"predecessor-version":[{"id":1424,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/posts\/1418\/revisions\/1424"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/media\/1421"}],"wp:attachment":[{"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/media?parent=1418"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/categories?post=1418"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ebnet.us\/index.php\/wp-json\/wp\/v2\/tags?post=1418"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}