Notification text for a Binary Sensor

I have a simple binary sensor … a switch … and I want an automation to send me the status as an email. Below is a snippet of code from the automation

action:

  • service: notify.emailer
    data:
    message: Power status {{states
    (‘binary_sensor.110_vac.state’) }}
    title: Power status
    mode: single

The service works fine … I use it for lots of emails. But what comes in the body of the email is unexpected

Power status unknown

Unknown ?

I’ve searched and searched but am drawing a blank. Everything I’ve found suggests this should work, although I’ve found nothing directly on point.

Help?

Hi. you should post your code as YAML - see the sticky at the top of the forum. What is the actual name of your sensor? I suspect you dont need the .state for it to work.

Try adding your sensor value in the Developer Tools → Template section to get instant feedback on your syntax.

should be

{{states('binary_sensor.110_vac') }}

Thanks! That worked !

However, as I check my list of attempts, I see that I did try that and it resulted in an error when I tried to save the edit.

(I was pretty methodical in my investigation.)

This time, I did a copy and paste of your text and no save error …

When I’m at a computer (on my phone now), I’ll do a more thorough compare.

Thanks again!

That was a copy and paste of the YAML, but I see something weird happened between the editor in the HA Android app and the Chrome editor for this forum.

But it’s working now.