Wemo compatibility

Compatibility (hardware, devices and OS)
superczar
Posts: 90
Joined: Wednesday 14 January 2015 13:08
Target OS: Raspberry Pi
Domoticz version:
Location: India
Contact:

Re: Wemo compatibility

Post by superczar » Sunday 25 January 2015 9:22

OK, so I am still struggling with getting motion sensor output from ouimeaux to trigger a json
In the interim, here is a quick solution to get demo to work (All credit for the original script to the author - http://moderntoil.com/?p=839&cpage=1 )

1) Create a dummy switch for Wemo
2) download the script referenced above to scripts by:

Code: Select all

  cd /home/pi/domoticz
mkdir wemo
cd wemo
wget http://moderntoil.com/file_attachments/wemo_control.sh
3) Get your wemo switch IP
4) test that the script works
5) Create 2 scripts for switching your demo on/off e.g for on

Code: Select all

#!/bin/sh
/home/pi/domoticz/scripts/wemo/wemo_control.sh [i]your wemo IP[/i] ON

6) It would be a good idea to go into your router and reserve the memo ip

That's it

superczar
Posts: 90
Joined: Wednesday 14 January 2015 13:08
Target OS: Raspberry Pi
Domoticz version:
Location: India
Contact:

Re: Wemo compatibility

Post by superczar » Monday 26 January 2015 7:00

Success with the motion sensor as well which is now working very nicely- Will post on the Wiki later today

crisman
Posts: 12
Joined: Wednesday 14 January 2015 18:03
Target OS: Raspberry Pi
Domoticz version:
Location: Porto, Portugal
Contact:

Re: Wemo compatibility

Post by crisman » Monday 26 January 2015 11:50

superczar wrote:Success with the motion sensor as well which is now working very nicely- Will post on the Wiki later today
Hello superczar,

I've 3 WeMo Insight switch's and on the Android apk I can see de power usage, time on, estimated price and so on, is it possible to get that information on Domoticz and also be able to use/create the rules?

Thanks.

superczar
Posts: 90
Joined: Wednesday 14 January 2015 13:08
Target OS: Raspberry Pi
Domoticz version:
Location: India
Contact:

Re: Wemo compatibility

Post by superczar » Wednesday 28 January 2015 14:00

Added to Wiki
http://www.domoticz.com/wiki/Wemo

Crisman - SOrry, I don't have an insight switch so can't solve for that - The library I used says it does support Insight though

rodriguezyohann
Posts: 1
Joined: Wednesday 11 February 2015 10:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

Wemo compatibility

Post by rodriguezyohann » Wednesday 11 February 2015 10:53

Thanks for this script and integration for Domoticz.

It's possible to create similar script in order to know status of Wemo Swtich ?

This script could change automaticaly status on/off in domoticz when I change status of wemo switch with the physical switch.

crisman
Posts: 12
Joined: Wednesday 14 January 2015 18:03
Target OS: Raspberry Pi
Domoticz version:
Location: Porto, Portugal
Contact:

Wemo compatibility

Post by crisman » Monday 23 March 2015 23:52

Last week I got a RPi 2, downloaded the image from the website and put it on the SD card, successfully installed Domoticz on RPi 2 and the followed the Wiki to have the Wemo switch working but it seems it does not.
Logged on Domoticz by SSH and have run the scripts from the command line and got this:

Code: Select all

 [email protected] ~/domoticz/scripts/wemo $ wemo_control 192.168.10.125 OFF
-bash: wemo_control: command not found
My experience in linux is very poor, could someone explain me what it could be wrong?

tastycarp
Posts: 1
Joined: Saturday 13 June 2015 7:17
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Wemo compatibility

Post by tastycarp » Saturday 13 June 2015 7:32

I had issues with the moderntoil script as used on the wiki with command not found.

This is what I did, it's a mash up of the wiki docs and ouimeaux. It's more of a personal preference and it works well for me
I installed ouimeaux as per https://ouimeaux.readthedocs.org/en/lat ... ation.html

I tested the wemo from the command line, the wemo status function is cool when the lamp is in the other room
use wemo list to find your switches and their friendly names

my wemo_on.sh and wemo_off.sh were modified to

Code: Select all

#!/bin/sh
wemo switch "WeMo Switch" on
(change the "WeMo Switch" to your friendly name and on to off for the off script)
dont forget to chmod +x the sh files

on action in your Domoticz switch
script://home/pi/domoticz/scripts/wemo/wemo_on.sh
off action
script://home/pi/domoticz/scripts/wemo/wemo_off.sh

daveaus
Posts: 2
Joined: Thursday 08 October 2015 8:01
Target OS: Windows
Domoticz version:
Contact:

Re: Wemo compatibility

Post by daveaus » Thursday 08 October 2015 8:06

Hi All,

Is it possible to run wemos using Domoticz on a windows server?

I got stuck at the .sh script. I installed Cygwin but it didn't help.

Thanks!

burton666
Posts: 95
Joined: Monday 17 August 2015 21:25
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Wemo compatibility

Post by burton666 » Sunday 14 February 2016 11:17

I found this script witch is supposed to be able to control all wemo devices including the Wemo bulbs.:
I can use the LINK LIST command to see all connected devices and GETSTATE to se the status of the device. But I can't turn change the state of any of the bulbs. Does anyone know how to modify the script to fix this?

Code: Select all

#!/bin/sh
#
# WeMo Control Script
# 
# Original author: [email protected]
#
# Modified 7/13/2014 by Donald Burr
# email: <[email protected]>
# web: <http://DonaldBurr.com>
#
# Modified 05/12/2014 by Jack Lawry
# email: <[email protected]>
# web: <http://www.jacklawry.co.uk>
#
# Modified 31/05/2015 by Wagner Oliveira
# * Fixed Port parameter and added Support for WeMo Link LED Bulbs
# email: <[email protected]>
# web: <http://guino.home.insightbb.com>
#
# Usage: wemo IP_ADDRESS[:PORT] ON|OFF|TOGGLE|GETSTATE|GETSIGNALSTRENGTH|GETFRIENDLYNAME
#    or: wemo IP_ADDRESS[:PORT] LINK [LIST|NAME ON [0-255]|OFF]

if [ "$1" = "" ]; then
    echo "Usage: wemo IP_ADDRESS[:PORT] ON|OFF|TOGGLE|GETSTATE|GETSIGNALSTRENGTH|GETFRIENDLYNAME"
    echo "   or: wemo IP_ADDRESS[:PORT] LINK [LIST|NAME ON [0-255]|OFF]"
   exit 1
fi

IP=$1
CMD=`echo $2 | tr '[a-z]' '[A-Z]'`

PORT=0
IPHASPORT=$(echo $IP | grep :)

if [ "$IPHASPORT" == "" ]; then

   for PTEST in 49154 49152 49153 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

   echo "INFO: Connected to" $1":"$PORT

else

    PORT=$(echo $IP | awk -F : '{print $2}')
   IP=$(echo $IP | awk -F : '{print $1}')
   echo "Using provided port: $PORT"

fi

if [ "$CMD" = "GETSTATE" ]; then 
   STATE=`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'`
   echo $STATE
   if [ "$STATE" = "OFF" ]; then
      exit 0
   elif [ "$STATE" = "ON" ]; then
      exit 1
   else
      exit 2
   fi
elif [ "$CMD" = "TOGGLE" ]; then 
   STATE=`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'`
   echo $STATE
   if [ "$STATE" = "OFF" ]; then
      # echo "ITS OFF - TURNING ON"
      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
      exit
   elif [ "$STATE" = "ON" ]; then
      # echo "ITS ON - TURNING OFF"
      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
      exit
   else
      # echo "UNKNOWN"
      exit
   fi
elif [ "$CMD" = "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 [ "$CMD" = "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 [ "$CMD" = "GETSIGNALSTRENGTH" ]; then
   curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:basicevent:1#GetSignalStrength\"" --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:GetSignalStrength xmlns:u="urn:Belkin:service:basicevent:1"><GetSignalStrength>0</GetSignalStrength></u:GetSignalStrength></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/basicevent1 |
   grep "<SignalStrength"  | cut -d">" -f2 | cut -d "<" -f1
elif [ "$CMD" = "GETFRIENDLYNAME" ]; then
   curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:basicevent:1#GetFriendlyName\"" --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:GetFriendlyName xmlns:u="urn:Belkin:service:basicevent:1"><FriendlyName></FriendlyName></u:GetFriendlyName></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/basicevent1 |
   grep "<FriendlyName"  | cut -d">" -f2 | cut -d "<" -f1
elif [ "$CMD" = "LINK" ]; then
   # Get Unique Device Number and List of Devices/IDs
   UDN=$(wget -qO- http://$IP:$PORT/setup.xml | grep UDN | awk -F'>|<' '{print $3}')
   DEVS=$(curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#GetEndDevices\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetEndDevices xmlns:u="urn:Belkin:service:bridge:1"><ReqListType>SCAN_LIST</ReqListType><DevUDN>'$UDN'</DevUDN></u:GetEndDevices></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 | awk '{ gsub(">", "\n"); print }')
   if [ "$3" == "LIST" ]; then
      echo "$DEVS" | grep "Name" | awk -F "&" '{ print $1 }' | grep -v -e "^$"
   else
      GROUPNAMES=$(echo "$DEVS" | grep -iE '(/GroupID|/GroupName)' | awk -F "&" '{print $1}')
      BULBNAMES=$(echo "$DEVS" | grep -iE '(/FriendlyName|/DeviceID)' | awk -F "&" '{print $1}')
      ID=$(echo "$DEVS" | grep -iE '(/GroupID|/GroupName|/FriendlyName|/DeviceID)' | awk -F "&" '{print $1}' | awk 'NR%2{a=$0;next}{print $0 "@"a;}' | grep "$3" | awk -F @ '{print $2}')
      if [ "$ID" == "" ]; then
         echo "$3 was not found."
         exit 254
      fi
      ISGROUP=$(echo "$GROUPNAMES" | grep "$ID")
       if [ "$ISGROUP" != "" ]; then
         ISGROUP="YES"
      else
         ISGROUP="NO"
      fi
      if [ "$4" == "ON" ]; then
         LEVEL=255
         if [ "$5" != "" ]; then
            LEVEL=$5
         fi
         # Send ON command
         curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#SetDeviceStatus\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1"><DeviceStatusList><?xml version="1.0" encoding="UTF-8"?><DeviceStatus><DeviceID>'$ID'</DeviceID><CapabilityID>10008</CapabilityID><CapabilityValue>'$LEVEL':0</CapabilityValue><IsGroupAction>'$ISGROUP'</IsGroupAction></DeviceStatus></DeviceStatusList></u:SetDeviceStatus></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 > /dev/null
         UPDATESTATUS=1
      elif [ "$4" == "OFF" ]; then
         # Send OFF Command
         curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#SetDeviceStatus\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1"><DeviceStatusList><?xml version="1.0" encoding="UTF-8"?><DeviceStatus><DeviceID>'$ID'</DeviceID><CapabilityID>10008</CapabilityID><CapabilityValue>0:0</CapabilityValue><IsGroupAction>'$ISGROUP'</IsGroupAction></DeviceStatus></DeviceStatusList></u:SetDeviceStatus></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 > /dev/null
         UPDATESTATUS=1
      elif [ "$4" == "TOGGLE" ]; then
         # Determine if device IS ON
         ISON=$(echo "$DEVS" | grep -iE '(/GroupCapabilityValues|/GroupName|/CurrentState|/FriendlyName)' | awk -F "&" '{print $1}' | awk 'NR%2{a=$0;next}{print a","$0;}' | grep "$3" | awk -F "," '{print $2}')
         LEVEL=$(echo "$DEVS" | grep -iE '(/GroupCapabilityValues|/GroupName|/CurrentState|/FriendlyName)' | awk -F "&" '{print $1}' | awk 'NR%2{a=$0;next}{print a","$0;}' | grep "$3" | awk -F "," '{print $3}')
         # echo "ISON=$ISON LEVEL=$LEVEL"
         if [ "$ISON" == "1" ]; then
            LEVEL="0"
         fi
         # Send Command to TOGGLE
         curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#SetDeviceStatus\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1"><DeviceStatusList><?xml version="1.0" encoding="UTF-8"?><DeviceStatus><DeviceID>'$ID'</DeviceID><CapabilityID>10008</CapabilityID><CapabilityValue>'$LEVEL':0</CapabilityValue><IsGroupAction>'$ISGROUP'</IsGroupAction></DeviceStatus></DeviceStatusList></u:SetDeviceStatus></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 > /dev/null
         UPDATESTATUS=1
      elif [ "$4" == "GETSTATE" ]; then
         echo "$DEVS" | grep -iE '(/GroupCapabilityValues|/GroupName|/CurrentState|/FriendlyName)' | awk -F "&" '{print $1}' | awk 'NR%2{a=$0;next}{print a","$0;}' | grep "$3" | awk -F "," '{print "ON: "$2"\nLevel: "$3}'
      else
         SHOWUSAGE=1
      fi
   fi
else
   SHOWUSAGE=1
fi

# When you switch LEDs ON/OFF you must request the device status so it will correctly report it later when you use GETSTATE
if [ "$UPDATESTATUS" == "1" ]; then
   if [ "$ISGROUP" == "YES" ]; then
      GRPIDS=$(echo "$DEVS" | grep -iE '(/GroupID)' | awk -F "&" '{print $1}' | awk '{print}' ORS=',' | awk '{print substr($0, 0, length($0)-1)}')
      DEVIDS=$(echo "$DEVS" | grep -iE '(/DeviceID)' | awk -F "&" '{print $1}' | awk '{print}' ORS=',' | awk '{print substr($0, 0, length($0)-1)}')
      # echo "GRPIDS=$GRPIDS ** DEVIDS=$DEVIDS"
      curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#GetDeviceStatus\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1"><DeviceIDs>'$GRPIDS'</DeviceIDs></u:GetDeviceStatus></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 > /dev/null
      curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#GetDeviceStatus\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1"><DeviceIDs>'$DEVIDS'</DeviceIDs></u:GetDeviceStatus></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 > /dev/null
   else
      curl -0 -A '' -X POST -H 'Accept: ' -H 'Content-type: text/xml; charset="utf-8"' -H "SOAPACTION: \"urn:Belkin:service:bridge:1#GetDeviceStatus\"" --data '<?xml version="1.0"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:GetDeviceStatus xmlns:u="urn:Belkin:service:bridge:1"><DeviceIDs>'$ID'</DeviceIDs></u:GetDeviceStatus></s:Body></s:Envelope>' -s http://$IP:$PORT/upnp/control/bridge1 > /dev/null
   fi
fi

if [ "$SHOWUSAGE" == "1" ]; then
   echo "COMMAND NOT RECOGNIZED"
   echo ""
   echo "Usage: wemo IP_ADDRESS[:PORT] ON|OFF|TOGGLE|GETSTATE|GETSIGNALSTRENGTH|GETFRIENDLYNAME"
   echo "   or: wemo IP_ADDRESS[:PORT] LINK [LIST|NAME ON [0-255]|OFF|TOGGLE|GETSTATE]"
   exit 255
fi

staber
Posts: 4
Joined: Sunday 20 March 2016 16:49
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Wemo compatibility

Post by staber » Friday 25 March 2016 22:01

Hi,

thank you for your wiki!

I have a problème with the motion sensor. In the wiki :
6) Create another script under /home/pi/domoticz/scripts/wemo called run_sensor.sh

#!/bin/sh
sudo python /home/pi/ouimeaux/ouimeaux/examples/motion2.py "Wemo Motion"
I don't have this file motion2.py or ouimeaux directory at all...

Does the script should not refer to motion_watch.py under /home/pi/domoticz/scripts/wemo ?

I get this error :
http://192.168.1.31:8080/json.htm?type= ... ff&level=0
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gevent-1.1.0-py2.7-linux-armv7l.egg/gevent/pywsgi.py", line 884, in handle_one_response
self.run_application()
File "/usr/local/lib/python2.7/dist-packages/gevent-1.1.0-py2.7-linux-armv7l.egg/gevent/pywsgi.py", line 871, in run_application
self.process_result()
File "/usr/local/lib/python2.7/dist-packages/gevent-1.1.0-py2.7-linux-armv7l.egg/gevent/pywsgi.py", line 860, in process_result
for data in self.result:
File "/usr/local/lib/python2.7/dist-packages/ouimeaux-0.7.9_r0-py2.7.egg/ouimeaux/subscribe.py", line 77, in _handle
('Connection', 'close')
File "/usr/local/lib/python2.7/dist-packages/gevent-1.1.0-py2.7-linux-armv7l.egg/gevent/pywsgi.py", line 778, in start_response
raise UnicodeError("The value must be a native string", header, value)
UnicodeError: ('The value must be a native string', 'Content-Length', 41)
{'CONTENT_LENGTH': '132',
'CONTENT_TYPE': 'text/xml; charset="utf-8"',
'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_HOST': '192.168.1.31:8989',
'HTTP_NT': 'upnp:event',
'HTTP_NTS': 'upnp:propchange',
'HTTP_SEQ': '1',
'HTTP_SID': 'uuid:59c29ffe-1dd2-11b2-aab1-9c52c2dc799b',
'PATH_INFO': '/',
'QUERY_STRING': '',
'REMOTE_ADDR': '192.168.1.113',
'REMOTE_PORT': '4938',
'REQUEST_METHOD': 'NOTIFY',
'SCRIPT_NAME': '',
'SERVER_NAME': 'raspberrypi',
'SERVER_PORT': '8989',
'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'gevent/1.1 Python/2.7',
'wsgi.errors': <open file '<stderr>', mode 'w' at 0x76cea0d0>,
'wsgi.input': <gevent.pywsgi.Input object at 0x75a39458>,
'wsgi.multiprocess': False,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)} failed with UnicodeError
Any help ?

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Wemo compatibility

Post by krizzz » Saturday 07 January 2017 0:17

Also I am am having some struggles with making the scripts from the wiki to work.

When installing the wemo_control.sdh script and making the wemo_on and wemo_off scripts there was no issue. Even when making the dummy switch, and switching it, Domotica reporst nicely that the "Admin initiated a switch command (37/Wemo/On)". But the Wemo switch doesnt do anything.

When activating the script through the commandline (sh wemo_on.sh) it says the following:

Code: Select all

wemo_on.sh: 2: wemo_on.sh: /home/pi/domoticz/scripts/wemo_control: not found
When looking into the script, I followe the wiki and the path to the script is correct and the script is present in the directory:

Code: Select all

[email protected]:~/domoticz/scripts/wemo$ ls -1
wemo_control.sh
wemo_off.sh
wemo_on.sh
Why can it not "find" the script? What am I missing?

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Wemo compatibility

Post by krizzz » Wednesday 11 January 2017 7:33

Nobody that is dealing with the same issues??


Verzonden vanaf mijn iPhone met Tapatalk

Dropshot
Posts: 49
Joined: Tuesday 20 December 2016 23:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Wemo compatibility

Post by Dropshot » Thursday 12 January 2017 23:06

krizzz wrote:Nobody that is dealing with the same issues??
I do, I've the exact same issue. Does anyone have a solution?

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Wemo compatibility

Post by krizzz » Wednesday 22 February 2017 0:35

Just an update, I AM able to control my Wemo switches, but not yet through Domoticz. Through the commandline on my pi I have installed ouimeaux https://ouimeaux.readthedocs.io/en/late ... ation.html. And then when issuing the command

Code: Select all

wemo list
on the commandline. My wemo switch appeared! WHen giving the "on"command it even turned on. So quite a surprise.

Now the difficult part, howto control through Domoticz the ouimeaux programm to control the switch. I will find out :)

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Wemo compatibility

Post by krizzz » Wednesday 08 March 2017 23:03

Ok, i know how to switch my Wemo switch through domoticz. Quite easy after knowing what to do :). I will update the wiki accodingly because to me, the script now present in the wiki is not working......

Dropshot
Posts: 49
Joined: Tuesday 20 December 2016 23:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Wemo compatibility

Post by Dropshot » Monday 13 March 2017 1:00

krizzz wrote:Ok, i know how to switch my Wemo switch through domoticz. Quite easy after knowing what to do :). I will update the wiki accodingly because to me, the script now present in the wiki is not working......
Great, that would help a lot! Did you already update the wiki? :)

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Wemo compatibility

Post by krizzz » Monday 13 March 2017 23:11

Decided not to not update the wiki, because I have never done that. Feels a little bit strange overwriting somebody else his/her work! Please find below what I used to get my Wemo Switch working.... I found the details for my working setup in https://ouimeaux.readthedocs.io/en/late ... html#basic. I will post the steps starting from the beginning...

SSH to your Pi/Linux installation with Domotica installed and do:

1. Install Ouimeaux with

Code: Select all

sudo easy_install ouimeaux
2. Ouimeaux requires Python header files to build some dependencies, and I do not know if these are already there on a Raspbian build, so therefore start with

Code: Select all

sudo apt-get install python-setuptools python-dev
3.Then, after everything is installed with a simple

Code: Select all

wemo list
you can see your active devices or do

Code: Select all

wemo status
to check status of your device.

4. Test your device by setting it on or off by

Code: Select all

wemo switch "TV Room" on
and of course here you replace the name "TV Room" with the name of you Wemo device. Also turn it back off again

Code: Select all

wemo switch "TV Room" off
5. Within Domoticz we now have to create a virtual switch, to create a virtual switch, you first have to create a virtual hardware device. Go to Setup > Hardware. Type in a name say Dummy1, choose 'Dummy (Does nothing, use for virtual switches only)' from the drop-down. Leave 'Data timeout' disabled. Click on 'Add'. Then go to the 'Switches' tab. Click the 'Manual Light/Switch' button in the upper left corner. Choose the dummy hardware from the drop-down. Enter a name ('WeMo Switch'). Switch type 'On/off'. Type 'X10'. For 'House code' and 'Unit code', choose some random, doesn't really matter. As 'Main Device'.

6.Next we will have to create some scripts to turn on and off your Wemo device. Do

Code: Select all

mkdir /home/pi/domoticz/scripts/wemo
to make a dir within the domoticz scripts "section" and next go to this dir

Code: Select all

cd /home/pi/domoticz/scripts/wemo
7. Create a on and off script with

Code: Select all

sudo nano wemo_on.sh
and fill it with the correct code to contact your Wemo device you located earlier. Ofcourse change the "NAMEOFDEVICE" part with the name you found earlier

Code: Select all

#!/bin/sh
sudo wemo switch "NAMEOFDEVICE" ON
Save the script you just created with CTRL+O and close the nano editor CTRL+X

8. Do the same as for step 6 but now for a script with a different name

Code: Select all

sudo nano wemo_off.sh
and code

Code: Select all

#!/bin/sh
sudo wemo switch "NAMEOFDEVICE" OFF
and also here, replace the part "NAMEOFYOURDEVICE" with the name of you specific Wemo device

9. Make the on/off scripts executable with

Code: Select all

chmod +x wemo_on.sh
and

Code: Select all

chmod +x wemo_off.sh
10. Then link the On/off scripts to the dummy switch on/off actions by pressing the edit button of the on/of switch you created at step 5 within domoticz

11. Add to the line "On Action:" the path to the script, in my case it is

Code: Select all

script:///home/pi/domoticz/scripts/wemo/wemo_on.sh
and for the "Off Action" add the path to the off script

Code: Select all

script:///home/pi/domoticz/scripts/wemo/wemo_off.sh
Please note that the path to the script HAS to start with

Code: Select all

script:///
. Took me a long time to find this out :)

Now you should be able to control your Wemo device through a switch within domoticz!

krizzz
Posts: 164
Joined: Wednesday 20 November 2013 21:36
Target OS: Linux
Domoticz version:
Location: The Netherlands
Contact:

Re: Wemo compatibility

Post by krizzz » Saturday 18 March 2017 22:40

Somebody figured out howto make a script for checking if the switch is on or off? If so, then I can put it in the crontab.

i looked at the example in the wiki for the motion detector but this was way above my knowledge level!

Dropshot
Posts: 49
Joined: Tuesday 20 December 2016 23:29
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Wemo compatibility

Post by Dropshot » Sunday 19 March 2017 12:16

Hi Krizzz,

Thank you for this tutorial, although I don't seem to get this working. When I do the sudo easy_install ouimeaux, i get the following message: error: Setup script exited with error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

What am I doing wrong here? I've added the log.
Attachments
log_easy-install ouimeaux.txt
(19.9 KiB) Downloaded 14 times

manutremo
Posts: 25
Joined: Saturday 19 November 2016 18:02
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Wemo compatibility

Post by manutremo » Sunday 19 March 2017 13:34

In case it can be of help, I'm using the simple and effective wemo_control.sh script at http://moderntoil.com/file_attachments/wemo_control.sh with my Wemo Insight and domoticz with success.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests