Compare commits
No commits in common. "4761bfea0f4e10064ef3c54fa7a404f0ce544ab5" and "11ae8bfaf60cddfa9ccb51ac5c8606c8a9fef9bd" have entirely different histories.
4761bfea0f
...
11ae8bfaf6
@ -39,19 +39,21 @@ delete_expired_at_jobs() {
|
|||||||
# Verwende die Funktion, um überholte Jobs zu löschen
|
# Verwende die Funktion, um überholte Jobs zu löschen
|
||||||
delete_expired_at_jobs
|
delete_expired_at_jobs
|
||||||
|
|
||||||
# Die IP-Adresse von Lisas-IPhone holen und Ping-Test durchführen
|
# Die IP-Adresse von Lisas-IPhone holen.
|
||||||
check_ip() {
|
check_ip() {
|
||||||
mac_address="e4:cd:d1" # Ersetze dies durch die MAC-Adresse
|
mac_address="e4:cd:d1" # Ersetze dies durch die MAC-Adresse
|
||||||
A72_ip=$(arp-scan --localnet | grep "$mac_address" | awk '{print $1}')
|
A72_ip=$(arp-scan --localnet | grep "$mac_address" | awk '{print $1}')
|
||||||
|
|
||||||
if [ -z "$A72_ip" ]; then
|
|
||||||
echo "IP nicht gefunden. Ziel ist nicht erreichbar."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Gefundene IP: $A72_ip"
|
echo "Gefundene IP: $A72_ip"
|
||||||
|
}
|
||||||
|
|
||||||
# Ping-Test durchführen
|
# check_ip -Funktion ausführen.
|
||||||
|
check_ip
|
||||||
|
|
||||||
|
# Datei zum Speichern der geplanten Weckzeiten
|
||||||
|
weckzeit_datei="/root/iobroker_scripts/generel/.weckzeiten.txt"
|
||||||
|
|
||||||
|
# Überprüfen, ob das Ziel über Ping erreichbar ist
|
||||||
|
function is_target_reachable() {
|
||||||
echo "teste ping $A72_ip"
|
echo "teste ping $A72_ip"
|
||||||
local ping_output=$(/bin/ping -q -w 3 -c 3 $A72_ip 2>&1)
|
local ping_output=$(/bin/ping -q -w 3 -c 3 $A72_ip 2>&1)
|
||||||
local ping_exit_code=$?
|
local ping_exit_code=$?
|
||||||
@ -64,15 +66,12 @@ check_ip() {
|
|||||||
else
|
else
|
||||||
echo "Das Ziel ist nicht erreichbar. Exit Code: $ping_exit_code"
|
echo "Das Ziel ist nicht erreichbar. Exit Code: $ping_exit_code"
|
||||||
return 1 # Fehler: Das Ziel ist nicht erreichbar
|
return 1 # Fehler: Das Ziel ist nicht erreichbar
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# check_ip -Funktion ausführen.
|
# Überprüfen, ob das Ziel erreichbar ist
|
||||||
check_ip || exit 1 # Beende das Skript, wenn das Ziel nicht erreichbar ist
|
if is_target_reachable; then
|
||||||
|
|
||||||
# Datei zum Speichern der geplanten Weckzeiten
|
|
||||||
weckzeit_datei="/root/iobroker_scripts/generel/.weckzeiten.txt"
|
|
||||||
|
|
||||||
# Ziel ist erreichbar, Alarmzeit über SSH abrufen
|
# Ziel ist erreichbar, Alarmzeit über SSH abrufen
|
||||||
alarmTime=$(ssh -i /root/.ssh/A72 root@$A72_ip dumpsys alarm | grep -A 6 ":com.urbandroid.sleep.alarmclock.ALARM_ALERT" | grep "type=RTC_WAKEUP origWhen=" | cut -d= -f3 | cut -c1-16 | uniq)
|
alarmTime=$(ssh -i /root/.ssh/A72 root@$A72_ip dumpsys alarm | grep -A 6 ":com.urbandroid.sleep.alarmclock.ALARM_ALERT" | grep "type=RTC_WAKEUP origWhen=" | cut -d= -f3 | cut -c1-16 | uniq)
|
||||||
|
|
||||||
@ -105,3 +104,7 @@ else
|
|||||||
|
|
||||||
rm "$weckzeit_datei"
|
rm "$weckzeit_datei"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "Ziel ist nicht erreichbar."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
28
wecker.sh
28
wecker.sh
@ -39,32 +39,11 @@ set_color() {
|
|||||||
iobroker state set zigbee.0.04cd15fffee03198.color "$color_value"
|
iobroker state set zigbee.0.04cd15fffee03198.color "$color_value"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Die IP-Adresse von Lisas-IPhone holen und Ping-Test durchführen
|
# Die IP-Adresse von Lisas-IPhone holen.
|
||||||
check_ip() {
|
check_ip() {
|
||||||
mac_address="e4:cd:d1" # Ersetze dies durch die MAC-Adresse
|
mac_address="e4:cd:d1" # Ersetze dies durch die MAC-Adresse
|
||||||
A72_ip=$(arp-scan --localnet | grep "$mac_address" | awk '{print $1}')
|
A72_ip=$(arp-scan --localnet | grep "$mac_address" | awk '{print $1}')
|
||||||
|
|
||||||
if [ -z "$A72_ip" ]; then
|
|
||||||
echo "IP nicht gefunden. Ziel ist nicht erreichbar."
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Gefundene IP: $A72_ip"
|
echo "Gefundene IP: $A72_ip"
|
||||||
|
|
||||||
# Ping-Test durchführen
|
|
||||||
echo "teste ping $A72_ip"
|
|
||||||
local ping_output=$(/bin/ping -q -w 3 -c 3 $A72_ip 2>&1)
|
|
||||||
local ping_exit_code=$?
|
|
||||||
|
|
||||||
echo "$ping_output" # Ausgabe des Ping-Befehls anzeigen
|
|
||||||
|
|
||||||
if [ $ping_exit_code -eq 0 ] && [[ "$ping_output" == *"3 received"* ]]; then
|
|
||||||
echo "Das Ziel ist erreichbar."
|
|
||||||
return 0 # Erfolg: Das Ziel ist erreichbar
|
|
||||||
else
|
|
||||||
echo "Das Ziel ist nicht erreichbar. Exit Code: $ping_exit_code"
|
|
||||||
return 1 # Fehler: Das Ziel ist nicht erreichbar
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# check_ip -Funktion ausführen.
|
# check_ip -Funktion ausführen.
|
||||||
@ -91,7 +70,6 @@ check_notification() {
|
|||||||
|
|
||||||
for ((i = 1; i <= $max_attempts; i++)); do
|
for ((i = 1; i <= $max_attempts; i++)); do
|
||||||
# Führe den SSH-Befehl innerhalb eines Timeout aus
|
# Führe den SSH-Befehl innerhalb eines Timeout aus
|
||||||
check_ip # IP holen
|
|
||||||
output=$(ssh -i /root/.ssh/A72 root@$A72_ip 'dumpsys activity processes | grep com.urbandroid.sleep')
|
output=$(ssh -i /root/.ssh/A72 root@$A72_ip 'dumpsys activity processes | grep com.urbandroid.sleep')
|
||||||
echo $output
|
echo $output
|
||||||
|
|
||||||
@ -162,13 +140,13 @@ colortemp_step=$(bc <<< "$start_colortemp / $steps")
|
|||||||
set_brightness "$current_brightness"
|
set_brightness "$current_brightness"
|
||||||
set_colortemp "$current_colortemp"
|
set_colortemp "$current_colortemp"
|
||||||
|
|
||||||
sleep 30 # Änderungen alle 30 Sekunden
|
sleep 27 # Änderungen alle 30 (27) Sekunden
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# check_ip -Funktion ausführen.
|
# check_ip -Funktion ausführen.
|
||||||
check_ip
|
check_ip
|
||||||
echo "$A72_ip"
|
echo "$A72_ip"
|
||||||
|
|
||||||
# Starten des Alarm-Scripts auf dem Handy.
|
# Starten des Alarm-Scripts auf dem Handy.
|
||||||
ssh -i /root/.ssh/A72 root@$A72_ip '/data/scripts/morning-alarm.sh' > /root/morning_alarm.log
|
ssh -i /root/.ssh/A72 root@$A72_ip '/data/scripts/morning-alarm.sh' > /root/morning_alarm.log
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user