Using variables in HTML email notification

I’ve been playing recently with rich HTML email notifications. These are specifically to provide status information vs. status alerts. I want them to provide relevant information in the alert, but haven’t figured out how to replace some of the HTML with sensor names, sensor states, etc.

  - service: notify.google_smtp
      title: Home Assistant Alert
      message: Tesla range low
        html: >
          <!DOCTYPE html>
         <h4>Status Information:</h4>
         <h2>Tesla battery range now [sensor.tesla_battery_range]</h2>

Trying to get ‘sensor.tesla_battery_range’ to be the state of that sensor…
I tried {{ states(‘sensor.tesla_range_sensor’) }}
But it errors out in Configuration test.


How about?

{{ states.sensor.tesla_range_sensor.state }}
1 Like

Yep, that did the trick, thank you!