Hi everyone, I’m relatively new to Home Assistant and struggling to get the “friendly” state values that seem to be based on the device class of the sensor. For example, I created a sensor to show the internet status like this:
binary_sensor:
- platform: ping
name: Internet #(or whatever you want to name it)
host: 8.8.8.8
scan_interval: 60
I want to display the state using a template but this code returns, for example “on” instead of “Connected” which you would see if you went to the Info tab of the entity.
{{ states("binary_sensor.internet") }}
Is there a way to retrieve the more “friendly” version of the state values using templates?
Please use a proper formatting for a code - triple “`”, without “>” prefixes.
As for “Connected”:
Assume that you have already defined an appropriate “device_class” for this sensor (here - “connectivity”).
Cards like “history-graph”, “entities” (as well as more-info popup) show a translated “nice” labels like “Connected / Disconnected”.
But in templates you will still get “on/off”: