Skip to content

Instantly share code, notes, and snippets.

@ebith
Created April 20, 2019 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ebith/ae654efa12670f931dd5ef632d385d6b to your computer and use it in GitHub Desktop.
Save ebith/ae654efa12670f931dd5ef632d385d6b to your computer and use it in GitHub Desktop.
暗いときは30秒だけ明かりをつけるOctoPrint用スクリプト
#!/bin/sh
hour=$(date +%H)
if [ "$hour" -lt 9 ]; then
exit
fi
mean=$(curl -s "http://localhost/webcam/?action=snapshot" | identify -format "%[mean]" jpg:- | cut -d . -f 1)
if [ "$mean" -lt 1000 ]; then
curl -s "http://192.168.0.82:42897/api/light/on"
(sleep 30; curl -s "http://192.168.0.82:42897/api/light/off") &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment