andrey-git / home-assistant-custom-ui

Custom UI elements for https://home-assistant.io
https://home-assistant.io
MIT License
528 stars 97 forks source link

icon_color template does not work in 0.88 #168

Closed cklit closed 5 years ago

cklit commented 5 years ago

Checklist

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.

rzolau commented 5 years ago

Can confirm the same issue.

HACee commented 5 years ago

Same problem here as well.

jncanches commented 5 years ago

Same as 169. I debugged it already. Hope Andrew will have time tout update it.

Sjeff commented 5 years ago

same issue on version 0.88.1.

rhadamantys commented 5 years ago

dito. homeassistant 0.88.1 using chrome

josh929800 commented 5 years ago

Same issue on version 0.88.1 using any browser.

mrfoxbit commented 5 years ago

same issue on version 0.88.1

varrcan commented 5 years ago

same issue on version 0.88.1

WhistleMaster commented 5 years ago

In the mean time, someone found a solution using hs_color

rzolau commented 5 years ago

This is rather surprising workaround, and as far as I can tell it uses HSV color space (but at least for me) ignores V component...

peterhoe commented 5 years ago

@rzolau same for me (being surprising that is), the V or B (or last integer) seems to be ignored (makes no difference with color no matter what i make that last value)

cklit commented 5 years ago

This is rather surprising workaround, and as far as I can tell it uses HSV color space (but at least for me) ignores V component...

Same here. But then again, it IS called hs_color, so I guess it's not false advertising ;) Works as a workaround, but looking forward for the solution :)

josh929800 commented 5 years ago

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;

      '
richpuch commented 5 years ago

hs_color works for me with the help of

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;

      '

How do you get the color white to work with hs_color? I tried ever combination, but it defaults to blue icons.

       hs_color: >
          if (entities['climate.pool_heater'].state ==='off') return [120,0];
          if (entities['climate.pool_heater'].state ==='heat') return [50.3,79.2];
        brightness:  >
          if (entities['climate.pool_heater'].state ==='off') return 255;
          if (entities['climate.pool_heater'].state ==='heat') return 250.92;
andrey-git commented 5 years ago

Fixed in 2019-03-24