From 2d15fe099c6559dddd8b8b133b000ebe68e93543 Mon Sep 17 00:00:00 2001 From: Ratatoskr Date: Mon, 18 Dec 2023 12:56:31 +0100 Subject: [PATCH] =?UTF-8?q?Anpassungen=20am=20Wecker-Script:=20-=20Ge?= =?UTF-8?q?=C3=A4nderte=20Mac-Adresse=20f=C3=BCr=20Lisas=20iPhone=20in=20c?= =?UTF-8?q?heck=5Fip-Funktion.=20-=20Verbesserte=20Ausgabe=20in=20der=20ch?= =?UTF-8?q?eck=5Fnotification-Funktion.=20-=20Angepasste=20Schritte=20und?= =?UTF-8?q?=20Dauer=20f=C3=BCr=20die=20Helligkeits-=20und=20Farbtemperatur?= =?UTF-8?q?anpassung.=20-=20Start=20des=20Alarm-Scripts=20auf=20dem=20Hand?= =?UTF-8?q?y=20mit=20protokollierter=20Ausgabe.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wecker.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/wecker.sh b/wecker.sh index b2d7670..5850a88 100755 --- a/wecker.sh +++ b/wecker.sh @@ -41,9 +41,11 @@ set_color() { # Die IP-Adresse von Lisas-IPhone holen. check_ip() { - mac_address="e4:cd:d1" # Ersetze dies # Die IP-Adresse von Lisas-IPhone holen. + mac_address="18:ab:1d" # Ersetze dies # Die IP-Adresse von Lisas-IPhone holen. A72_ip=$(arp -a | grep "$mac_address" | awk '{print $2}' | sed 's/[()]//g') echo "$A72_ip" + echo "$A72_ip" + echo "$A72_ip" } # check_ip -Funktion ausführen. @@ -66,11 +68,12 @@ check_external_light_status() { # Checkt, ob der Wecker am Handy ausgeschaltet wurde. check_notification() { # Führe den SSH-Befehl innerhalb eines Timeout aus - output=$(timeout 5s ssh -i /root/.ssh/A72 root@$A72_ip 'dumpsys activity processes | grep com.urbandroid.sleep' || echo "Timeout") - - # Überprüfe, ob das Ergebnis nicht "Timeout" ist und den Wecker enthält - if [[ $output != *"Timeout"* && $output == *"com.urbandroid.sleep/.alarmclock.AlarmKlaxon"* ]]; then + output=$(ssh -i /root/.ssh/A72 root@$A72_ip 'dumpsys activity processes | grep com.urbandroid.sleep') + echo $output + # Überprüfe, ob das Ergebnis den Wecker enthält + if [[ $output == *"AlarmKlaxon"* ]]; then date && echo "Wecker noch nicht beendet." + echo $output else date && echo "Wecker beendet." echo $output @@ -89,7 +92,7 @@ end_colortemp=0 # Kaltweiß (0) # Dauer der Anpassung in Sekunden (15 Minuten) -duration_seconds=899 +duration_seconds=900 # Alle 30 Sekinden Änderung steps=30 # Alle 30 Sekunden einen Schritt @@ -99,7 +102,7 @@ brightness_step=$(bc <<< "($end_brightness - $start_brightness) / $steps") colortemp_step=$(bc <<< "$start_colortemp / $steps") # Schrittweise Anpassung von Helligkeit und Farbtemperatur - for ((i = 0; i < $steps; i++)); do + for ((i = -1; i < $steps; i++)); do current_brightness=$(bc <<< "$start_brightness + ($brightness_step * $i)") current_colortemp=$(bc <<< "$start_colortemp - ($colortemp_step * $i)") @@ -118,10 +121,11 @@ colortemp_step=$(bc <<< "$start_colortemp / $steps") set_brightness "$current_brightness" set_colortemp "$current_colortemp" - sleep 30 # Änderungen alle 30 Sekunden + sleep 28 # Änderungen alle 30 Sekunden done -ssh root@$A72_ip '/data/scripts/morning-alarm.sh' +# Starten des Alarm-Scripts aauf dem Handy. +ssh -i /root/.ssh/A72 root@$A72_ip '/data/scripts/morning-alarm.sh' > morning_alarm.log # Farben ändern für mehr konzentration while :; do