I always try to set up “Script Objects” that do only ONE thing so they can be called by anyone… reusable code Notifications are a great example of this… I have two ways of notifying myself of events now from any automation… by just adding another action block
NOTE: my email notification differs only in the recipient of who gets the message
You must have the smtp: and notify: tags in your configuration.yaml exposed
You set up the notify entity like this… either in your Config.yamal or Notifications.yaml
send_sms_email_message:
alias: Send parameter to sms message
sequence:
- service: notify.sms_email_notification
data_template:
message: '{{ body }}'
title: '{{ subject }}'
And then the automation which calls it, in the example below its calling my email notification AND the SMS notification ie two actions
- id: '1569076733304'
alias: Test Email Prams
trigger:
- entity_id: switch.leviton2 #<== I'm using a switch to "exercise" the code
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
body: This is the body of the message
subject: Testing Pramertized Email Messages
service: script.send_email_message
action:
- data:
body: This is the body of the message
subject: Testing Parameterized SMS Email Messages
service: script.send_sms_email_message
Big thanks goes out to all the members who figured most of the details and shared their examples… I just had to carry it a short distance! SMTP Componet Notify Componet
FYI - for Verizon you can also use [email protected], which will send it as MMS message instead of SMS. MMS allows pictures and longer messages. A web search for MMS via email should return links with carriers’ email formats.