Remote switch FMT IP Network Socket via HTTP / FMT Netzwerksteckdose per HTTP schalten
Product:
Get state request
curl -q http://${LAMPHOST}/status.xml 2>/dev/null
XML response
Get state request
curl -q http://${LAMPHOST}/status.xml 2>/dev/null | sed -ne 's/.*\(.*\)<\/led1>.*/\1/p'
boolean result
0
Toogle state request
Script to switch on and off
#!/bin/bash
#
#
LAMPHOST="YOUR.LAMP.IP.ADDRESS"
if [ "$1" == "0" ] || [ "$1" == "1" ]; then
LAMPTARGETSTATE=$1
LAMPSTATE=`curl -q http://${LAMPHOST}/status.xml 2>/dev/null | sed -ne 's/.*\(.*\)<\/led1>.*/\1/p'`
# you can only toggle the state :-)
if [ "$LAMPSTATE" != "$LAMPTARGETSTATE" ]; then
fi
exit 0
fi
echo "Usage: lamp.sh [0,1]"
exit 1
Thank's to Oliver Otzen for his great reverse engineering and script.
Thank's to Oliver Otzen for his great reverse engineering and script.
Labels: curl, HTTP, IP, network, netzwerk, shell, socket, steckdose