Commit: Fix check_notification condition and add check_external_light_status
1. Added a new function `check_external_light_status` to check if the light is turned off externally. 2. Modified the condition in the `check_notification` function to correctly check if the notification contains "[1]" and the specified strings. 3. Corrected the assignment statement inside the `while` loop. Changed `first_brightness_cmason.nvimhange=false` to `first_brightness_change=false`.
This commit is contained in:
parent
fcc070e03d
commit
96e857a4cf
13
wecker.sh
13
wecker.sh
@ -55,11 +55,20 @@ check_ip
|
||||
first_brightness_change=true
|
||||
|
||||
# Überprüfung, ob das Licht extern ausgeschaltet wurde
|
||||
check_external_light_status() {
|
||||
local light_status=$(iobroker state getValue zigbee.0.04cd15fffee03198.state)
|
||||
if [ "$light_status" == "false" ]; then
|
||||
echo "Licht ist aus. Das Skript wird beendet."
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
# Überprüfung, ob der Wecker am Handy beendet wurde.
|
||||
check_notification() {
|
||||
local output
|
||||
output=$(ssh a72 'dumpsys notification | grep "Beenden"')
|
||||
|
||||
if [[ $output == *"Beenden"* && $output == *"com.urbandroid.sleep"* ]]; then
|
||||
if [[ $output == "[1]"* && output == *"Beenden"* && $output == *"com.urbandroid.sleep"* ]]; then
|
||||
echo "Wecker noch nicht beendet."
|
||||
else
|
||||
echo "Wecker beendet."
|
||||
@ -115,7 +124,7 @@ while :; do
|
||||
if [ "$first_brightness_change" = false ]; then
|
||||
check_external_light_status
|
||||
else
|
||||
first_brightness_cmason.nvimhange=false
|
||||
first_brightness_change=false
|
||||
fi
|
||||
|
||||
show_status $i "$current_brightness" "$current_colortemp"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user