Using sensor state in email notification

Struggling with the syntax for this, caonfig is always invalid. Searched but can’t find documentation or examples. It works without the bolded data item. I see examples for image data, but not text. When I eliminate the data: itema dn try to put the IP in the message, I cannot get that to work either. Help with the YAML syntax would be appreciated.

  • alias: Email notification if public IP changes
    description: ‘’
    trigger:
    platform: state
    entity_id: sensor.crystal_public_IP
    from: ‘’
    to: ‘’
    for: ‘’
    action:
    • data:
      message: ‘Public IP address has changed’
      title: ‘HASS.IO public IP change’
      data: 'IP has changed to {state_attr(‘sensor.crystal_public_IP’, ‘state’)}'
      service: notify.gmail
      id: 8996a3ec66184a268a397250ab52fdd9

Please format your YAML code properly. As it is it is very difficult to read, and hence, make suggestions.

EDIT: If you’re not sure how, see especially item #11 from: