Skip to content

Instantly share code, notes, and snippets.

@ebith
Created Apr 20, 2019
Embed
What would you like to do?
暗いときは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