Getting notifications to display "friendly" state for alarm sensors

I’ve setup all my alarm sensors as binary sensors with their respective types (door, window, motion) - from the home-assistant front-end they display neatly as Window : Open/Closed or Motion Sensor : Clear/Detected - etc… but when I send the state via notification they display as on/of (e.g. Window: On/Off instead of Open/Closed). If I try friendly_state I get a blank.

Is there anyway to get the notifications to display the “friendly” state as per the front-end without customization for each sensor?

Did you use device_class to set up the binary sensor states?

Edit. Never mind. I just tested {{ states('binary_sensor.pir_bathroom') }} in the template editor and it does indeed display as “off” rather than the expected “clear” as the sensor is defined as a motion device_class.

I just realised I’ve never actually tried to display a sensor state in a notification. I word things like this:

  message: "The {{ trigger.to_state.attributes.friendly_name }} Smoke Alarm has TRIGGERED!!!"

So I’m interested in the answer too.

Yes - device_class - I currently have a script that reports all “on” sensors when arming the alarm, or checking the status. Looks a little untidy when it sends reports : “Bathroom Window is On. Pool Beam Is On. Pool Light is On” etc

The “Yet Another Alarm System” custom alarm panel does this. Might be worth looking through the code to see how Gaz does it (if you don’t want to switch over to using his panel, which is brilliant btw). YET another take on an alarm system

Edit: Yeah, that’s no help. He does it with python.

A bit more reading and it looks like you only have this option:

Thanks - I’ll look into it a bit further in a week or two, at the moment its a “nice to have” feature on my priority list.

I know this is old, but it looks like you can look at the source. Example for weather: