效果:通过wake on lan远程唤醒电脑后,电脑自动通知我已经启动了
- Homeassistant设置
configuration中配置邮件通知
# Notify
notify:
- name: email
platform: smtp
server: smtp.qq.com
port: 587
timeout: 15
sender: ***@qq.com
encryption: starttls
username: ***@qq.com
password: ****
recipient:
- ***@qq.com
sender_name: Home Assistant
- Homeassistant脚本设置
9020_notify:
alias: 9020_notify
sequence:
- service: notify.email
data:
message: 9020已经启动
title: 通知:9020已经启动
mode: single
-
Homeassistant长期访问令牌
在HA用户界面最下面生成长期访问令牌 -
在windows 上写个bat脚本, 注Homeassistant最好有域名及https
curl -X POST -H "Authorization: Bearer 长期访问令牌" -H "Content-Type: application/json" -d "{\"entity_id\": \"script.9020_notify\"}" https://域名或ip:8123/api/services/script/turn_on
-
在windows上“编辑组策略”
计算机配置\windows设置\脚本(启动/关闭)\ 启动
添加刚才地bat脚本 -
完成!
网友评论