diff --git a/wecker.sh b/wecker.sh index 6c673c7..93f751b 100755 --- a/wecker.sh +++ b/wecker.sh @@ -136,7 +136,7 @@ check_notification() { echo $output iobroker state set zigbee.0.04cd15fffee03198.state false /root/iobroker_scripts/general/generate_text.sh > /dev/null - return # Exit the function without terminating the entire script + exit # Beende das Skript, wenn der Alarm ausgeschaltet wurde else # Phone unreachable echo "Phone unreachable. Waiting $wait_time seconds before the next attempt." @@ -147,9 +147,9 @@ check_notification() { # Phone could not be reached. echo "Phone could not be reached after $max_attempts attempts." - date && echo "Alarm turned off." - iobroker state set zigbee.0.04cd15fffee03198.state false - return + date && echo "Alarm turned off." + iobroker state set zigbee.0.04cd15fffee03198.state false + exit # Beende das Skript, wenn das Telefon nicht erreicht werden konnte } # Define starting values for brightness and color temperature @@ -181,7 +181,7 @@ echo "Reached final brightness: $((brightness_step * steps + start_brightness)) colortemp_step=$(( start_colortemp / steps )) echo "Color temperature difference per step: $colortemp_step" echo "Reached final colortemp: $((start_colortemp - colortemp_step * steps)) from $end_colortemp" -sleep_duration=$((duration_seconds / steps)) +sleep_duration=$((duration_seconds / steps - 3)) # Gradual adjustment of brightness and color temperature for ((i = 1; i <= $steps; i++)); do @@ -241,7 +241,7 @@ if [ $current_brightness -eq $end_brightness ] && [ $current_colortemp -eq $end_ echo "DEBUG: Alternative ssh command." ssh_command "cmd media_session volume scripts/--set 5 --stream 9 && /data/data/com.termux/files/usr/bin/mpv /data/scripts/your-new-morning-alarm.ogg" else - ssh_command "/data/scripts/morning-alarm.sh > /dev/null" + nohup ssh a72 '/data/scripts/morning-alarm.sh 2>&1 | /data/data/com.termux/files/usr/bin/tee /data/scripts/morning-alarm.log' fi else check_external_light_status