I want the icon of my smart band to change its icon depends on where I am (in which room), so I used this code in customize.yaml but does not do anything. It shows empty icon:
sensor.alex_room:
icon: >
if (state === 'office') return 'mdi:desktop-classic';
else if (state === 'bedroom') return 'mdi:bed';
else if (state === 'livingroom') return 'mdi:sofa';
else if (state === 'diningroom') return 'mdi:table-furniture';
else if (state === 'kitchen') return 'mdi:toaster-oven';
else return 'mdi:cellphone';
Am I doing it wrong, how can I change mushroom card entity card icon based on state. I want to be able to use this in my dashboard, and see which person is in which room:
You cannot use templates in customize.yaml. Either, create a template sensor which sets the icon and use that in your card, or use a mushroom template card.