Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #修改成自己HA的IP:PORT,注意等號左右不能有空格唷!!
- DST=http://192.168.XXX.XXX:8123
- #觸發HA的webhook以執行自動化
- curl -X POST \
- -H "Content-Type: application/json" \
- -d "{ \"level\": \"$1\" , \"seconds\": \"$2\" }" \
- $DST/api/webhook/trigger_ea_cmd
- #line notify權杖,頭尾引號勿刪除,引號裡面不能有空格
- line_token="REPLACE_WITH_YOUR_TOKEN"
- #Telegram Bot的API key與chat id,都不需要引號,注意等號左右不能有空格唷!!
- TG_API_KEY=12345678:AAGKyWWA
- MYCHAT_ID=12345678
- #通知內容
- msg="警告!!芮氏規模$1的地震,將於$2秒後到達!!"
- #截圖指令,如果圖片路徑及檔案名稱有不同,下面通知記得一併修改!
- VNC=:0 gnome-screenshot -w -f /config/oxwu/OX.png
- #發送line通知
- curl -X POST https://notify-api.line.me/api/notify \
- -H "Authorization: Bearer "$line_token \
- -F "message=${msg}" \
- -F "imageFile=@/config/oxwu/OX.png"
- #發送TG通知
- curl -X POST https://api.telegram.org/bot$TG_API_KEY/sendPhoto \
- -F "chat_id=${MYCHAT_ID}" \
- -F "photo=@/config/oxwu/OX.png" \
- -F "caption=${msg}"
- #等待1秒
- sleep 1s
- #刪除截圖
- rm -f /config/oxwu/OX.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement