Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions wemo
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#==============================================================================#
# 10 Main: Argument Error #
# 11 Main: Run Action Error #
# 12 Main: Unable to detect port for device #
# 20 restPostXmlStdinBelkinSoap: Argument Error #
# 21 restPostXmlStdinBelkinSoap: Missing/Empty URL #
# 22 restPostXmlStdinBelkinSoap: Missing/Emtpy SOAP Header #
Expand Down Expand Up @@ -302,12 +303,22 @@ done
#123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789
# Identify TCP port to use #
#123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789
PORTTEST="$( curl --silent ${DEVICE_HOST}:49153 | grep "404" )"
if testEmpty "${PORTTEST}"
declare -a ports=(49152 49153 49154 49155)
PORT=0
for p in "${ports[@]}"
do
PORTTEST="$( curl --max-time 10 --silent ${DEVICE_HOST}:$p | grep "404" )"
if ! testEmpty "${PORTTEST}"
then
PORT=$p
break
fi
done

if [ "$PORT" -le "0" ]
then
PORT=49152
else
PORT=49153
echoError "Unable to detect port for ${DEVICE_HOST}"
finish 12
fi

#123456789o123456789o123456789o123456789o123456789o123456789o123456789o123456789
Expand Down