Skip to content

Commit

Permalink
Always login to FB to turn on or off
Browse files Browse the repository at this point in the history
  • Loading branch information
christian1980nrw authored Sep 30, 2023
1 parent f526d52 commit abf850d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ if (( execute_charging == 1 && use_victron_charger == 1 )); then
fi

# Execute Fritz DECT on command
if (( execute_switchablesockets_on == 1 && use_fritz_dect_sockets == 1 )); then
if (( use_fritz_dect_sockets == 1 )); then
echo "I: Executing 1 hour Fritz switching." | tee -a "$LOG_FILE"
# Get session ID (SID)
sid=""
Expand All @@ -922,6 +922,8 @@ if (( execute_switchablesockets_on == 1 && use_fritz_dect_sockets == 1 )); then
if [ -n "$DEBUG" ]; then
echo "I: Login to Fritz!Box successful." | tee -a "$LOG_FILE"
fi
fi
if (( execute_switchablesockets_on == 1 && use_fritz_dect_sockets == 1 )); then

# Iterate over each socket
for socket in "${sockets[@]}"
Expand All @@ -936,7 +938,7 @@ if (( execute_switchablesockets_on == 1 && use_fritz_dect_sockets == 1 )); then
state=$(curl -s "http://$fbox/webservices/homeautoswitch.lua?sid=$sid&ain=$socket&switchcmd=getswitchstate")

if [ "$connected" = "1" ]; then
echo "Turning socket $socket on for almost 60 minutes and then off again..." | tee -a "$LOG_FILE"
echo "Turning socket $socket on." | tee -a "$LOG_FILE"
url="http://$fbox/webservices/homeautoswitch.lua?sid=$sid&ain=$socket&switchcmd=setswitchon"
if ! curl -s "$url" > /dev/null; then
echo "E: Could not call URL '$url' to switch on said switch - ignored."
Expand Down

0 comments on commit abf850d

Please sign in to comment.