Skip to content

Commit

Permalink
Fix oref0-ns-loop.sh pushover_snooze NS authorization (#1393)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeremy Cunningham <jpcunningh@gmail.com>
  • Loading branch information
jpcunningh and Jeremy Cunningham committed Apr 20, 2021
1 parent 1d9e5f5 commit bec71ed
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bin/oref0-ns-loop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ EOT

function pushover_snooze {
URL=$NIGHTSCOUT_HOST/api/v1/devicestatus.json?count=100
if snooze=$(curl -s $URL | jq '.[] | select(.snooze=="carbsReq") | select(.date>'$(date +%s -d "10 minutes ago")')' | jq -s .[0].date | noquotes); then
if [[ "${API_SECRET}" =~ "token=" ]]; then
URL="${URL}&${API_SECRET}"
else
CURL_AUTH='-H api-secret:'${API_SECRET}
fi

if snooze=$(curl -s ${CURL_AUTH} ${URL} | jq '.[] | select(.snooze=="carbsReq") | select(.date>'$(date +%s -d "10 minutes ago")')' | jq -s .[0].date | noquotes); then
#echo $snooze
#echo date -Is -d @$snooze; echo
touch -d $(date -Is -d @$snooze) monitor/pushover-sent
Expand Down

0 comments on commit bec71ed

Please sign in to comment.