helped a fellow member out today with this JS template for a name:
name: >
[[[var moon = states['sensor.moon'].state;
if (moon == 'new_moon') return 'Luna Nuova';
if (moon == 'waning_crescent') return 'Gibbosa crescente';
if (moon == 'waxing_crescent') return 'Mezzaluna crescente';
if (moon == 'first_quarter') return 'Primo Quarto';
if (moon == 'waxing_gibbous') return 'Gibbosa crescente';
if (moon == 'full_moon') return 'Luna Piena';
if (moon == 'waning_gibbous') return 'Gibbosa calante';
return 'Ultimo Quarto';]]]
in Jinja, I would have suggested creating a mapper, but in JS I dont think I ve seen that being used before, though it must be possible.
Could anyone check and see if we can do something like this in JS:
{% set mapper =
{'new_moon':'Luna Nuova',
'waning_crescent':'Gibbosa crescente',
'waxing_crescent':'Mezzaluna crescente',
'first_quarter':'Primo Quarto',
'waxing_gibbous':'Gibbosa crescente',
'full_moon':'Luna Piena',
'waning_gibbous':'Gibbosa calante'} %}
{% set state = states('sensor.moon') %}
{% set moon = mapper[state] if state in mapper else 'Ultimo Quarto' %}
{{moon}}