Map / tranform entity state value for UI

Hello,

I would like to transform some entity state values of sensors/binary_sensors, at least for display in lovelace UI. Two examples:

  • A binary sensor binary_sensor.landroid_batterycharging to indicate our lawnmower robot is charging or not. Since that is a binary sensor it displays on / off in the UI, I would like that to be transformed to yes / no
  • sensor.sirene_carport_armstate for a Homematic siren device has textual states for the arm state like extsens_armed or disarmed. They are very technical and I would like to transform into a more human understandable term

Any idea how entity states could easily be transformed in such cases?
Could not find anything here in the forum except using an additional template sensor, but I wonder if there is a smarter way to achieve that? Or maybe that is a new feature request :wink:

Thx.

Sidenote: I switched to HA from OpenHab recently, OpenHab has a transformation feature for that which allows to configure some mapping table or do more advanced stuff using Javascript.

I have actually the same question.
I know you can use templates to accomplish this behavior but it also determines the values you will be using in the backend and not only the frontend.
For me this would mean that I should be using Dutch words/namings in English scripts/automations and that just doesn’t feel right.

Did you manage to figure something out for this?

Hi, it’s a very old thread, but did you found any solution?

Check here