Skip to content
Open
36 changes: 30 additions & 6 deletions hook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ hook(){
openwbDebugLog "CHARGESTAT" 0 "$(cat ramdisk/hookmsg)"
rm ramdisk/hookmsg
openwbDebugLog "MAIN" 1 "Gerät 1 aktiviert"
msg_text="Gerät 1 eingeschaltet bei $uberschuss"
if ((pushbsmarthome == "1")) && ((pushbenachrichtigung == "1")); then
./runs/pushover.sh "Gerät 1 eingeschaltet bei $uberschuss"
./runs/pushover.sh "$msg_text"
fi
if ((telebsmarthome == "1")) && ((telebenachrichtigung == "1")); then
./runs/telegram.sh "$msg_text"
fi
fi
else
Expand All @@ -44,8 +48,12 @@ hook(){
openwbDebugLog "CHARGESTAT" 0 "$(cat ramdisk/hookmsg)"
rm ramdisk/hookmsg
openwbDebugLog "MAIN" 1 "Gerät 1 deaktiviert"
msg_text="Gerät 1 ausgeschaltet bei $uberschuss"
if ((pushbsmarthome == "1")) && ((pushbenachrichtigung == "1")); then
./runs/pushover.sh "Gerät 1 ausgeschaltet bei $uberschuss"
./runs/pushover.sh "$msg_text"
fi
if ((telebsmarthome == "1")) && ((telebenachrichtigung == "1")); then
./runs/telegram.sh "$msg_text"
fi
fi
fi
Expand All @@ -67,9 +75,13 @@ hook(){
openwbDebugLog "CHARGESTAT" 0 "WebHook 2 aktiviert"
openwbDebugLog "CHARGESTAT" 0 "$(cat ramdisk/hook2msg)"
rm ramdisk/hook2msg
msg_text="Gerät 2 eingeschaltet bei $uberschuss"
openwbDebugLog "MAIN" 1 "Gerät 2 aktiviert"
if ((pushbsmarthome == "1")) && ((pushbenachrichtigung == "1")); then
./runs/pushover.sh "Gerät 2 eingeschaltet bei $uberschuss"
./runs/pushover.sh "$msg_text"
fi
if ((telebsmarthome == "1")) && ((telebenachrichtigung == "1")); then
./runs/telegram.sh "$msg_text"
fi
fi
else
Expand All @@ -96,8 +108,12 @@ hook(){
openwbDebugLog "CHARGESTAT" 0 "$(cat ramdisk/hook2msg)"
rm ramdisk/hook2msg
openwbDebugLog "MAIN" 1 "Gerät 2 deaktiviert"
msg_text="Gerät 2 ausgeschaltet bei $uberschuss"
if ((pushbsmarthome == "1")) && ((pushbenachrichtigung == "1")); then
./runs/pushover.sh "Gerät 2 ausgeschaltet bei $uberschuss"
./runs/pushover.sh "$msg_text"
fi
if ((telebsmarthome == "1")) && ((telebenachrichtigung == "1")); then
./runs/telegram.sh "$msg_text"
fi
fi
fi
Expand All @@ -114,8 +130,12 @@ hook(){
curl -s --connect-timeout 5 $hook3ein_url > /dev/null
openwbDebugLog "CHARGESTAT" 0 "WebHook 3 aktiviert"
openwbDebugLog "MAIN" 1 "Gerät 3 aktiviert"
msg_text="Gerät 3 eingeschaltet bei $uberschuss"
if ((pushbsmarthome == "1")) && ((pushbenachrichtigung == "1")); then
./runs/pushover.sh "Gerät 3 eingeschaltet bei $uberschuss"
./runs/pushover.sh "$msg_text"
fi
if ((telebsmarthome == "1")) && ((telebenachrichtigung == "1")); then
./runs/telegram.sh "$msg_text"
fi
fi
fi
Expand All @@ -132,8 +152,12 @@ hook(){
curl -s --connect-timeout 5 $hook3aus_url > /dev/null
openwbDebugLog "CHARGESTAT" 0 "WebHook 3 deaktiviert"
openwbDebugLog "MAIN" 1 "Gerät 3 deaktiviert"
msg_text="Gerät 3 ausgeschaltet bei $uberschuss"
if ((pushbsmarthome == "1")) && ((pushbenachrichtigung == "1")); then
./runs/pushover.sh "Gerät 3 ausgeschaltet bei $uberschuss"
./runs/pushover.sh "$msg_text"
fi
if ((telebsmarthome == "1")) && ((telebenachrichtigung == "1")); then
./runs/telegram.sh "$msg_text"
fi
fi
fi
Expand Down
Loading