Page 1 of 1

wemo switch in wiki

Posted: Wednesday 24 May 2017 8:18
by markjgabb
hi there


has anyone has any luck with the simple switch scripts in the wiki?

ive followed them as well as i can but when i run the on or off switch i get nothing

i get a blank screen and the script just gets stuck no output no new input line....

Re: wemo switch in wiki

Posted: Thursday 29 June 2017 3:30
by markjgabb
ok so still stuck on this issue, neither the of the listed solutions work for me....using the simple script i was send i get a syntax at ip$=
and the other one with the complicated ouamux name doesnt seem to find my wemo devices..... i can control them form the wemo app, and directly, but the ouixmux or whatever its called cant find it...is there perhaps a firmware issues anyone is aware of?

Re: wemo switch in wiki

Posted: Monday 03 July 2017 3:20
by markjgabb
is there any active community member using the current wiki wemo script?
if not im guessing that there may have developed a error in syntax with an update somewhere....
my guess would be either a python update has killed it or something inherent int the Raspian image doesnt like syntax of the script....

Re: wemo switch in wiki

Posted: Thursday 28 September 2017 18:13
by henrit
Hi,

same problem with the "light" Wemo scripts described in : https://www.domoticz.com/wiki/Wemo

Can't get them to work : they generate the following error :
"Error executing script command (/home/android/domoticz/scripts/wemo/wemo_off.sh). returned: 256"

Browsing the Internet I could not find anyone with a positive experience of those scripts...
Apparently this part of the wiki is not up to date, and we are left struggling with non operational scripts !

By the way I read somewhere that Python is no longer supported (?) - hence in the log during start-up, the well-known "Python: Failed dynamic library load, install the latest libpython3.x library that is available for your platform" even if Python 3.x is correctly installed.

Re: wemo switch in wiki

Posted: Friday 29 September 2017 0:59
by hbennis
i'm using this script

Code: Select all

#!/bin/sh
#
# WeMo Control Script
#
# [email protected]
#
# Usage: ./wemo_control IP_ADDRESS ON/OFF/GETSTATE/GETSIGNALSTRENGTH/GETFRIENDLYNAME
#
#
IP=$1
COMMAND=$2

if [ "$2" = "" ]
   then
      echo "Usage: ./wemo_control IP_ADDRESS ON|OFF|GETSTATE"
else

    PORT=0
   
    for PTEST in 49152 49153 49154 49155
    do
            PORTTEST=$(curl -s -m 3 $IP:$PTEST | grep "404")
                     
            if [ "$PORTTEST" != "" ]
               then
               PORT=$PTEST
               break
            fi
    done
   
    if [ $PORT = 0 ]
             then
       echo "Cannot find a port"
       exit
    fi
   
   
    if [ "$1" = "" ]
       then
          echo "Usage: ./wemo_control IP_ADDRESS ON|OFF"
    else
       echo "Port = "$PORT
       
   
       if [ "$2" = "ON" ]
   
          then
   
             curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:basicevent:1#SetBinaryState\"" --data '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:SetBinaryState></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/basicevent1 |
    grep "<BinaryState"  | cut -d">" -f2 | cut -d "<" -f1
   
       elif [ "$2" = "OFF" ]
   
          then
   
             curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:basicevent:1#SetBinaryState\"" --data '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>0</BinaryState></u:SetBinaryState></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/basicevent1 |
    grep "<BinaryState"  | cut -d">" -f2 | cut -d "<" -f1
   
   elif [ "$2" = "GETSTATE" ]

      then

         curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:basicevent:1#GetBinaryState\"" --data '<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetBinaryState xmlns:u="urn:Belkin:service:basicevent:1"><BinaryState>1</BinaryState></u:GetBinaryState></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/basicevent1 |
grep "<BinaryState"  | cut -d">" -f2 | cut -d "<" -f1 | sed 's/0/OFF/g' | sed 's/1/ON/g'


       else
   
          echo "COMMAND NOT RECOGNIZED"
          echo ""
          echo "Usage: ./wemo_control IP_ADDRESS ON|OFF|GETSTATE"
          echo ""
   
       fi
   
    fi
fi   

Re: wemo switch in wiki

Posted: Saturday 03 February 2018 20:21
by prooney5
Since no one ever came back to say what worked.. I just wanted to point out that changing the wemo_control.sh to the one that hbennis posted above fixed my issues. I was having the problem of command just stuck. No output or anything. I didn't go through the whole thing but it seems like some extra nonsense has been taken out of the script. Also, some other things that were left out of the wiki that some people may need help with:
in both wemo_on.sh and wemo_off.sh make sure you capitalize ON and OFF... they are lowercase in wiki
and
chmod +x wemo_control.sh or chmod 755 wemo_control.sh if you run into a permission denied error.

Re: wemo switch in wiki

Posted: Thursday 22 February 2018 20:28
by toast
Works perfect for me. Just create a dummy switch and set the
On Action: script://wemo/wemo_control.sh 192.168.5.197 ON
Off Action: script://wemo/wemo_control.sh 192.168.5.197 OFF

So I don't know why you would want to create the additional scripts; wemo_on.sh wemo_off.sh...