Greetings!
I’m fairly new to Home Assistant, and at this stage I have Googled myself blue and would appreciate some direct help.
Is there a simple way to change icon, icon color, text color, state_badge color etc. based on the state or sensor value using vanilla Lovelace?
This code is working for a picture elements card, but is extremely verbose:
elements:
elements:
- entity: input_select.upstairs_temp_mode
icon: 'mdi:weather-sunny'
style:
'--paper-item-icon-color': green
left: 42%
top: 77%
transform: 'scale(2,2)'
tap_action:
action: toggle
type: state-icon
type: conditional
- conditions:
- entity: input_select.upstairs_temp_mode
state: Night
elements:
- entity: input_select.upstairs_temp_mode
icon: 'mdi:power-sleep'
style:
'--paper-item-icon-color': blue
left: 42%
top: 77%
transform: 'scale(2,2)'
tap_action:
action: toggle
type: state-icon
type: conditional
- conditions:
- entity: input_select.upstairs_temp_mode
state: Away
elements:
- entity: input_select.upstairs_temp_mode
icon: 'mdi:arrow-expand-left'
style:
'--paper-item-icon-color': black
left: 42%
top: 77%
transform: 'scale(2,2)'
tap_action:
action: toggle
type: state-icon
type: conditional
image: /local/house_top_floor.png
type: picture-elements
Background for specially interested:
I have spent too many hours now trying to get this to work without any add-ons. Surely, color and icon customisation must be part of the base package? After X hours I caved and installed Custom-UI only to find out an hour later that it is no longer maintained. icon_color don‘t work anymore with ha 0.110 · Issue #184 · andrey-git/home-assistant-custom-ui · GitHub
Help is greatly appreciated.
I have seen a lot of similar issues, but some of them are outdated and some recommend using deprecated add-ons. Seems like Custom-UI could have fulfilled my needs if supported.
I have numerous links, but limited as a new user.