1. Config configuration.yaml
- cd /home/homeassistant/.homeassistant
- nano configuration.yaml
2. Insert code notification and set Gmail user password
- notify:
- - name: "SendMail"
- platform: smtp
- server: smtp.gmail.com
- port: 587
- timeout: 15
- sender: scivalve.suwit@gmail.com
- encryption: starttls
- username: scivalve.suwit@gmail.com
- password: Password Gmail
- recipient:
- - suwit.jph@gmail.com
- - komkid@gmail.com
- - seksan.kamt56@gmail.com
- sender_name: My Home Assistant
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.
- {"message":"Test mail"}
4. Set Automation for send mail when track device ping down.
- nano automations.yaml
Add this code.
- - id: '1534491838266'
- alias: CheckPingDown
- trigger:
- - entity_id: device_tracker.sonoff
- platform: state
- condition:
- - after: '8:00'
- before: '18:00'
- condition: time
- - condition: state
- entity_id: device_tracker.sonoff
- state: not_home
- action:
- - data:
- message: Can't connect sonoff Garden. Please Check WIFI Or Sonoff.
- service: notify.sendmail
https://www.home-assistant.io/components/notify.smtp/
No comments:
Post a Comment