So I wanted to have the moon and season sensors show a bit nicer state in the frontend. Created these customizations/templates:
sensor.season:
templates:
icon: >
if (state === 'spring') return 'mdi:flower';
if (state === 'summer') return 'mdi:sunglasses';
if (state === 'autumn') return 'mdi:leaf';
if (state === 'winter') return 'mdi:snowflake';
return 'mdi:cloud';
icon_color: >
if (state === 'spring') return 'green';
if (state === 'summer') return 'yellow';
if (state === 'autumn') return 'orange';
if (state === 'winter') return 'blue';
return 'grey';
_stateDisplay: >
return state|title;
sensor.moon:
templates:
_stateDisplay: >
return state|title|replace('_',' ');
the exact same templates show like this:
only difference I can report between the 2 is that top is a Rpi3b+ with HassOs 1.12:
and the bottom is a Rpi3 with Hassos 1.10
both non beta, both 0.81.5
there are more differences between these versions. I donât understand them to be different in the first place. Is that because of the different hardware?
anyways, please see if these template could be made more robustâŚ