I know this has been covered, I’ve read the articles but cannot get this to work. In lovelace I have an “entity-button” card that will display if my Nest has a leaf or not (eco mode). I can get the icon to change from the default check mark to a leaf. However, When the Nest does have a leaf the color of the icon is yellow, i’d like it to be green. In my customize.yaml I have the following
I looked at the entity and sensor, everything matches up by case and spelling. I feel I’m close, I’ve tried icon_color and rgb_color, and every variation in between. Thanks!
This template only works with CustomUI, which is an extension of the frontend. Not Lovelace. I.E. It will never work in Lovelace. EDIT: Aparently the colors do. You probably don’t have CustomUI set up.
why would you say that? I have many colored icons in Lovelace:
btw not using rgb_color with isn’t supported any more. Use icon_color instead. Custom-ui seems to be rather well supported in Lovelace. No extra_badges, but the coloring is fine.
Custom-ui. Ive only just setup Lovelace, and was pleasantly surprised all the icon colors showed as hoped for…(took some dedication to get it all there…)
Surpisingly the cards card doesn’t work as expected. But then I only copied my config over to that format legacy-config. So maybe further tweaking is needed there. Tiles are showing though, which is a second relieve of todays job.
Sounds like I need to set up CustomUI then. I’ll try to figure that out this week. Otherwise, I updated my customize.yaml to look like the following . So once CustomUI is working, my green icon should work?
binary_sensor.main_floor_thermostat_has_leaf:
friendly_name: Leaf Status
icon: mdi:leaf
templates:
icon_color: >
if (state === 'on' return '#63ff02';
return '#808080';
2018-12-03 14:20:52 ERROR (MainThread) [homeassistant.components.websocket_api.decorators] Unexpected exception
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/websocket_api/decorators.py", line 16, in _handle_async_response
await func(hass, connection, msg)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/lovelace/__init__.py", line 476, in send_with_error_handling
result = await func(hass, connection, msg)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/lovelace/__init__.py", line 508, in websocket_lovelace_config
return await hass.async_add_executor_job(load_config, hass)
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/lovelace/__init__.py", line 160, in load_config
for card in view.get('cards', []):
TypeError: 'NoneType' object is not iterable
does that state template actually work? Ive never seen that before, and used _stateDisplay instead. Since that has been deprecated in the newer versions of HA, a working state template would be very welcome… Is any documentation on that available?
be ware that this can be dangerous, as the docs state, and can mess with your HA inner workings (it actually changes the state, not only the display of the state.)
Hi @Mariusthvdb, i’m struggeling to make it work and unfortunately it doesn’t.
If you don’t mind i will need your precious help.
I have some templates sensors which i changed the name, state and icons and they are working great.
I’m trying to use custom_ui for the icon colors without succes.