home-assistant-custom-ui: icon_color template does not work in 0.88

Checklist

  • [x ] I’m running the latest version of CustomUI (Update guide) or using a specific release that is not marked as “Broken”.
  • [x ] I tried to force-refresh (Ctrl+Shift+R / Ctrl+F5) the browser
  • [x ] (Optional, but recommended) I’m using Chrome or tried to reproduce the feature on Chrome.

Browser + Version: Chrome, Version 72.0.3626.109 (Official Build) (64-bit)

CustomUI version: 20190113

Home Assistant release (hass --version): Hass.io 0.88.0

Problem-relevant customize.yaml entries:

sensor.indendoers:
  device_class: temperature
  templates:
    icon_color: 'if (state > 24) return ''rgb(223, 76, 0)''; if (state >= 21 ) return
      ''rgb(12, 135, 102)''; return ''rgb(214, 189, 29)'';'

This configuration works in 0.87, but after updating to 0.88 the custom colors does not work. Possibly due to update on base card in 0.88.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

I got color working again on my dashboard… via the hs_color workaround with the brightness too…

I used http://colorizer.org/ to convert the RGB into Hue, Saturation, and Brightness. Then I took the (Brightness#/100)*255 = The number you need to give Home Assitant using the separate brightness template.

Thanks to @WhistleMaster for putting the link here and to @arsaboo for showing his work on how to fix the brightness issue. https://community.home-assistant.io/t/customui-discussion-thread/48694/25

input_boolean.home:
  templates:
    hs_color: 'if (state === ''on'') return [205,82]; else return [186,12];

      '
    brightness: 'if (state === ''on'') return 209; else return 147;

      '

In the mean time, someone found a solution using hs_color