From f07d7b5d87adf8ef61b7cdc7b9ab3ef68876d9ca Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 9 Jan 2022 15:03:17 +0100 Subject: ... --- files/files/usr/local/sbin/dayled.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/files/files/usr/local/sbin/dayled.sh b/files/files/usr/local/sbin/dayled.sh index 415aa51..a575b22 100755 --- a/files/files/usr/local/sbin/dayled.sh +++ b/files/files/usr/local/sbin/dayled.sh @@ -6,13 +6,16 @@ offset="$(uci get dayled.@dayled[0].offset)" twilight="$(uci get dayled.@dayled[0].twilight)" act() { - sunwait $1 $twilight $offset $latitude $longitude >/dev/null - local state=$? - if [ "$state" -eq 2 ]; then - cat /sys/class/leds/blue\:dome/max_brightness > /sys/class/leds/blue\:dome/brightness - elif [ "$state" -eq 3 ]; then - echo 0 > /sys/class/leds/blue\:dome/brightness - fi + if [ "${1}" = "wait" ]; then + sunwait wait $twilight $offset $latitude $longitude && sleep 5 || sleep 3600 + fi + sunwait poll $twilight $offset $latitude $longitude >/dev/null + local state=$? + if [ "$state" -eq 2 ]; then + cat /sys/class/leds/blue\:dome/max_brightness > /sys/class/leds/blue\:dome/brightness + elif [ "$state" -eq 3 ]; then + echo 0 > /sys/class/leds/blue\:dome/brightness + fi } while -- cgit v1.2.3