Say I want to implement a washing machine sensor. It has three states: idle, washing, and finished. Something like this:
template:
sensor:
- name: Washing Machine
state: >
{% if (....) %}
washing
{% elif (....) %}
idle
{% elif (....) %}
finished
{% else %}
undefined
{% endif %}
How do I add translations to these custom strings? I want to do something like:
{{ “sensor.washing_machine” | state_translated }} and get “Washing” (or whatever that would be in any language I might use).
I don’t want to use template mapping in cards because:
- It isn’t lovely and requires me to copy over these templates all the time
- It does not propagate to the whole UI, for example the logbook will still show washing not “Washing”.
I also don’t want to use localized states bc of multilingual users of my HA.