Created
April 20, 2019 15:17
-
-
Save ebith/ae654efa12670f931dd5ef632d385d6b to your computer and use it in GitHub Desktop.
暗いときは30秒だけ明かりをつけるOctoPrint用スクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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