Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #將全部內容複製後,另存為ea.sh,之後在地牛wake up中選擇此檔案執行,
- #需要先安裝curl指令:sudo apt install curl
- #HA的IP:PORT,注意等號左右不能有空格唷!!
- DST=http://192.168.xxx.xxx:8123
- #在HA內建立一個token(左下角你的名字上面點一下並拉到最下面,新增永久有效存取權杖),注意等號左右不能有空格唷!!
- TOKEN=xxxxx
- #要執行腳本的名稱
- SCRIPT=earthquake_alert
- curl -s -k -X POST -H "Authorization: Bearer $TOKEN" \
- -H "Content-Type: application/json" \
- -d "{ \"level\": \"$1\" , \"seconds\": \"$2\" }" \
- $DST/api/services/script/$SCRIPT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement