8/17/2018

Home Assistant :: Home Assistant Send Mail Gmail SMTP

Home Assistant :: Home Assistant Send Mail Gmail SMTP
1. Config configuration.yaml
  1. cd /home/homeassistant/.homeassistant
  1. nano configuration.yaml


2. Insert code notification and set Gmail user password
  1. notify:
  2.   - name: "SendMail"
  3.     platform: smtp
  4.     server: smtp.gmail.com
  5.     port: 587
  6.     timeout: 15
  7.     sender: scivalve.suwit@gmail.com
  8.     encryption: starttls
  9.     username: scivalve.suwit@gmail.com
  10.     password: Password Gmail
  11.     recipient:
  12.       - suwit.jph@gmail.com
  13.       - komkid@gmail.com
  14.       - seksan.kamt56@gmail.com
  15.     sender_name: My Home Assistant
  16.  


3. Test Send mail select service menu and select service we create on stab 2.
insert Service Data Optional And click CALL SERVICE check mail.
  1. {"message":"Test mail"}

4. Set Automation for send mail when track device ping down.
  1. nano automations.yaml

Add this code.
  1. - id: '1534491838266'
  2.   alias: CheckPingDown
  3.   trigger:
  4.   - entity_id: device_tracker.sonoff
  5.     platform: state
  6.   condition:
  7.   - after: '8:00'
  8.     before: '18:00'
  9.     condition: time
  10.   - condition: state
  11.     entity_id: device_tracker.sonoff
  12.     state: not_home
  13.   action:
  14.   - data:
  15.       message: Can't connect sonoff Garden. Please Check WIFI Or Sonoff.
  16.     service: notify.sendmail


https://www.home-assistant.io/components/notify.smtp/

No comments:

Post a Comment