Announcement

Collapse
No announcement yet.

Guide - How to use Belkin Wemo devices with HomeSeer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Guide - How to use Belkin Wemo devices with HomeSeer

    https://github.com/unrelatedlabs/java-wemo-bridge

    It produces a nice web interface which shows all Wemo devices detected on the network as well as the status and allows for URL control.

    Simple UI 'http://localhost:9700
    'http://localhost:9700/devices
    on 'http://localhost:9700/devices/{name}/on
    off 'http://localhost:9700/devices/{name}/off
    toggle 'http://localhost:9700/devices/{name}/toggle

    Once you have this setup with your Wemo device and can successfully issue on / off commands all you need to do is setup a couple of events in HomeSeer that trigger when a virtual device you create for the wemo is set to on or off.

    See in screenshot I have added a new device called wemoswitch1.

    Then simply setup a couple of events one for when the device gets turned on and another for when its turned off. The events will run an immediate script which gets the wemobridge url to turn the device on or off.

    Make the events look like this obviously changing from on to off as needed, make sure both events are "priority events".

    The code for easy copy and pasting is:
    &hs.GetURL("http://192.168.0.5:9700","/devices/wemoswitch1/on",TRUE,80)

    Obviously once again edit to your own environment including the IP.

    Once finished you can now control the wemo device within HomeSeer.

    If you want the power state to update automatically here is a bash script that loops every 30 seconds to check the power state and update HomeSeer via JSON. Again edit as needed, the device ref, your IP, name of the device and username and password for curl to access HomeSeer.

    I have the below script running automatically at boot to keep HomeSeer and the Wemo device in sync.

    Please note that this guide is for technical users only, I will not be providing basic technical assistance nor am I responsible if you mess up your system.



    #!/bin/bash
    while [ 1 ]
    do

    # WemoSwitch1 Status Monitor
    wemoswitch1=$(curl -s 'http://192.168.0.5:9700/devices/wemoswitch1/state' | cut -d ":" -f 2 | sed 's/}$//')
    if [ "$wemoswitch1" = true ] ; then
    echo "WemoSwitch1 Online"
    curl -u USERNAME:PASSWORD "http://192.168.0.5/JSON?request=controldevicebylabel&ref=443&label=on"
    else
    echo "WemoSwitch1 Offline"
    curl -u USERNAME:PASSWORD "http://192.168.0.5/JSON?request=controldevicebylabel&ref=443&label=off"
    fi

    sleep 30
    done

    If HomeSeer could please make an official lighting plugin for Belkin Wemo that would be awesome! The performance with my above method is excellent, I can't tell any delay between pressing on / off and the device going on or off. Also If I turn the device off manually via the button on the Wemo the status updates within HomeSeer within about 30 seconds.

    Oh I should also mention that this meathod allows for local control of the wemo device without an internet connection. I purposely have my wemo's not allowed access to the internet.

    Video demo of my setup:
    https://youtu.be/tAKs-A3fMos
    Attached Files
    Last edited by cytec; August 22, 2015, 06:53 AM.

    #2
    @Cytec,

    I do not know anything about Belkin wireless devices.

    That said could I install the posted Wemo bridge on my RPi2 and use a wireless stick on the RPi2 for communications to a separate wireless LAN just for Wemo device chit chat?
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

    HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    Comment


      #3
      So, what are the advantages over Z-Wave? Seems like the price is similar. Performance?
      Don

      Comment


        #4
        Belkin is another player in the automation realm of things.

        The above would let Homeseer talk to Wemo devices.

        Today Homeseer 3 talks to X10, UPB, Insteon, Hue and Z-Wave.

        ...what are the advantages over Z-Wave?

        It would be nice if HS3 talked to Zigbee and Wemo. Then you could pick and choose what devices you wanted doing whatever.

        Their stuff uses 802.11X wireless.

        Belkin WEMO

        WEMO is a series of products from Belkin International, Inc. that enables users to control home electronics from anywhere. The product suite includes the WEMO Switch, WEMO Motion Sensor, WEMO Insight Switch, WEMO Light Switch, NetCam and WEMO App. The WEMO Switch can be plugged into any home outlet, which can then be controlled from an iOS or Android smartphone running the WEMO App, via home WiFi or mobile phone network.

        The WEMO Motion Sensor can be placed anywhere; as long as it is connected to the same WiFi network. The WEMO Motion Sensor can turn on and off any of the WEMO devices connected to the WiFi network as people pass by. The WEMO Insight Switch provides more detailed information on power usage and cost estimating on devices plugged into the switch. The WEMO Light Switch is for use where a light is controlled by a single light switch. Multi-way switching is not supported at this time. The WEMO App controls the WEMO devices from anywhere in the world as long as the WEMO devices’ wireless network is connected to the Internet. WEMO devices can also be controlled using IFTTT technology. WEMO devices can also be controlled by voice through the Amazon Echo.
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

        HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

        Comment


          #5
          Hi Pete,

          I have the Wemo Bridge running on the Raspberry Pi 2 along with the Echo Bridge. I have to say I am very impressed with the performance of the Wemo, I cannot distinguish any difference between response time of turning on a wemo switch vs a z-wave switch using HomeSeer, both are very quick.

          You can use Wemo on a different wlan, I have mine on the main network. The trick is to set them up using internet access and the Belkin wemo phone app which joins them to the wireless network. The units store the wifi details locally.
          Once they are successfully joined I have my DHCP pass a fake gateway as part of the IP assignment to each Wemo.

          It must be a live fake gateway IP (any other device on the network), it doesn’t need to have internet access though.

          Advantages of the Wemo over Z-Wave are:
          • Cost, wemo is about 30 – 50% cheaper than Z-Wave here in Australia.
          • Wide availability (Wemo can be bought in many stores).
          • It can be used without a separate chip such as Z-Wave or Zigbee, all it needs is wifi.
          • Many people already have Wemo devices.

          Vera has a plugin, I don't see why HomeSeer can't:
          http://code.mios.com/trac/mios_belkin-wemo

          And yes I already know about the IFTTT option, personally I have no desire to use a cloud based service to interface between HomeSeer and my home lighting system. By using the local network response time is so fast I can't tell any delay between pressing on and seeing the light come on.

          I just made a video of my setup with the wemo:
          https://youtu.be/tAKs-A3fMos
          Last edited by cytec; August 22, 2015, 03:45 AM.

          Comment


            #6
            Here is a more efficient version of the bash script to keep the wemo switch status in sync with HomeSeer (if someone was to manually turn on the wemo by pressing the button on top for instance).

            This script checks every 30 seconds comparing the status between the Wemo Switch and the HomeSeer device, it only updates HomeSeer if there is a difference (they are out of sync):

            Code:
            #!/bin/bash
            while [ 1 ]
            do
            
            # Get WemoSwitch Status (True/False) and convert to On / Off variables for comparison with HomeSeer.
            wemoswitch1data=$(curl -s 'http://192.168.0.5:9700/devices/wemoswitch1/state' | cut -d ":" -f 2 | sed 's/}$//')
            if [ "$wemoswitch1data" = true ] ; then
            wemoswitch1status=On
            else
            wemoswitch1status=Off
            fi
            # Get HomeSeer Status (On/Off)
            wemoswitch1homeseer=$(curl -s -u USERNAME:PASSWORD 'http://192.168.0.5/JSON?request=getstatus&ref=443' | cut -d "," -f 8 | cut -d ":" -f 2 | sed 's:^.\(.*\).$:\1:')
            # Compare WemoSwitch Status to HomeSeer Status
            if [ "$wemoswitch1homeseer" = "$wemoswitch1status" ] ; then
            echo "wemoswitch1 in sync"
            else
            echo "wemoswitch1 out of sync, correcting..."
            # Double checking WemoSwitch Status to avoid communication conflict
            sleep 10
            wemoswitch1homeseer=$(curl -s -u USERNAME:PASSWORD 'http://192.168.0.5/JSON?request=getstatus&ref=443' | cut -d "," -f 8 | cut -d ":" -f 2 | sed 's:^.\(.*\).$:\1:')
            wemoswitch1data=$(curl -s 'http://192.168.0.5:9700/devices/wemoswitch1/state' | cut -d ":" -f 2 | sed 's/}$//')
            if [ "$wemoswitch1data" = true ] ; then
            wemoswitch1status=On
            else
            wemoswitch1status=Off
            fi
            if [ "$wemoswitch1homeseer" = "$wemoswitch1status" ] ; then
            echo "wemoswitch1 in sync"
            else
            if [ "$wemoswitch1status" = On ] ; then
            curl -u USERNAME:PASSWORD "http://192.168.0.5/JSON?request=controldevicebylabel&ref=443&label=on"
            else
            curl -u USERNAME:PASSWORD "http://192.168.0.5/JSON?request=controldevicebylabel&ref=443&label=off"
            fi
            fi
            fi
            
            sleep 30
            done
            I have to say I am quite happy with this setup, if I need new modules in the future I'll probably just go and buy some more Wemo's.
            Last edited by cytec; August 22, 2015, 12:14 PM.

            Comment


              #7
              Thank you Cytec.

              Yeah here typically the big box walk in hardware stores carry a few automation widgets and I have seen them discounted sometimes.

              Each of the big box stores appear to be pushing their negotiated automation soup du jour hardware stuff.

              Most folks typically already have a wireless AP up such that all that is needed is the Wemo automated devices. Makes for a an easy and fast automation configuration.

              That said I utilize mostly Amazon (Prime) here with the two day delivery even on Sundays. I have not had issues to date with hardware purchases.

              I am currently not dinging the RPi2 running the HS3 Zee-2 (limit of 5 plugins) running the Amazon Echo bridge such that adding the Wemo bridge wouldn't be an issue here.

              Relating to WLAN stuff using multiple test AP's on autonomous networks connected to separate interfaces on the PFSense BSD firewall. (a real mix today of stuff).
              - Pete

              Auto mator
              Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb

              HS4 Pro - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
              HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

              X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

              Comment


                #8
                Wemo

                I really like the idea of WiFi connected switches and energy reporting, especially if they can be anywhere on the internet (not just your local LAN). Wemo partially achieves this and also has it's own IFTTT channel.

                However Wemo devices have historically (several years !) been really troublesome / buggy and Belkin have been truly appalling in supporting them. I had several and I gave up on them after Belkin ignored / denied issues despite most users experiencing them. I was so frustrated I vowed to boycott Belkin products forever. Just recently however a new product management focus and things have got a whole lot better with several new firmware iterations and mine all work 100% now, although a few people do still seem to have outstanding issues. I've even bought a whole lot more as they work in places I can't connect via Z-Wave. Of course an EU version of Z-Net would be useful too ;-)

                I would really like to see Wemo integrated with HomeSeer. Whilst the solution based here is good it's not as tidy as it could (should) be with direct UPnP integration support. Aside from the required intermediary Wemo Bridge it also requires polling for status updates which is a poor mechanism because of CPU loading, bandwidth and in particular status update delay. The latter aspect can create quite problematic conditions for systems using extensive logic triggers.

                Yes there is a Wemo plugin for Vera but it doesn't work currently with the revised Wemo firmware. The original author ditched early Wemo as he got so frustrated with the bugs and now no longer maintains the code. It's a shame as it should work well now.

                However I have a couple of other apps with Wemo support and they do work well with instant discovery, updates and control. I have added Wemo to HS via this route using a device update in OpenHAB to update the HS virtual Wemo device. A direct HS Wemo plugin would be nicer though and there's a lot of Wemo switches out there.

                K

                Comment


                  #9
                  Hi Cytek, your method looks good. Can java-wemo-bridge work Windows HS or is it Linux only?

                  Originally posted by cytec View Post
                  https://github.com/unrelatedlabs/java-wemo-bridge

                  It produces a nice web interface which shows all Wemo devices detected on the network as well as the status and allows for URL control.

                  Simple UI 'http://localhost:9700
                  'http://localhost:9700/devices
                  on 'http://localhost:9700/devices/{name}/on
                  off 'http://localhost:9700/devices/{name}/off
                  toggle 'http://localhost:9700/devices/{name}/toggle

                  Once you have this setup with your Wemo device and can successfully issue on / off commands all you need to do is setup a couple of events in HomeSeer that trigger when a virtual device you create for the wemo is set to on or off.

                  See in screenshot I have added a new device called wemoswitch1.

                  Then simply setup a couple of events one for when the device gets turned on and another for when its turned off. The events will run an immediate script which gets the wemobridge url to turn the device on or off.

                  Make the events look like this obviously changing from on to off as needed, make sure both events are "priority events".

                  The code for easy copy and pasting is:
                  &hs.GetURL("http://192.168.0.5:9700","/devices/wemoswitch1/on",TRUE,80)

                  Obviously once again edit to your own environment including the IP.

                  Once finished you can now control the wemo device within HomeSeer.

                  If you want the power state to update automatically here is a bash script that loops every 30 seconds to check the power state and update HomeSeer via JSON. Again edit as needed, the device ref, your IP, name of the device and username and password for curl to access HomeSeer.

                  I have the below script running automatically at boot to keep HomeSeer and the Wemo device in sync.

                  Please note that this guide is for technical users only, I will not be providing basic technical assistance nor am I responsible if you mess up your system.



                  #!/bin/bash
                  while [ 1 ]
                  do

                  # WemoSwitch1 Status Monitor
                  wemoswitch1=$(curl -s 'http://192.168.0.5:9700/devices/wemoswitch1/state' | cut -d ":" -f 2 | sed 's/}$//')
                  if [ "$wemoswitch1" = true ] ; then
                  echo "WemoSwitch1 Online"
                  curl -u USERNAME:PASSWORD "http://192.168.0.5/JSON?request=controldevicebylabel&ref=443&label=on"
                  else
                  echo "WemoSwitch1 Offline"
                  curl -u USERNAME:PASSWORD "http://192.168.0.5/JSON?request=controldevicebylabel&ref=443&label=off"
                  fi

                  sleep 30
                  done

                  If HomeSeer could please make an official lighting plugin for Belkin Wemo that would be awesome! The performance with my above method is excellent, I can't tell any delay between pressing on / off and the device going on or off. Also If I turn the device off manually via the button on the Wemo the status updates within HomeSeer within about 30 seconds.

                  Oh I should also mention that this meathod allows for local control of the wemo device without an internet connection. I purposely have my wemo's not allowed access to the internet.

                  Video demo of my setup:
                  https://youtu.be/tAKs-A3fMos

                  Comment


                    #10
                    Osram Lightify Gardenspot

                    Has anyone tried using this to control the Osram Lightify Gardenspot outdoor lights? Do you get any color control using HS3 or is it simple off and on control? Does the REST API with Wemo allow for color control from HS3 via this java wemo bridge?

                    Comment


                      #11
                      wemo-bridge error

                      I'm trying to run the wemo-bridge.jar and getting the following error:

                      Running on Windows 10 with jave 1.8.0_91:

                      Code:
                      D:\wemo-bridge>"C:\Program Files\Java\jre1.8.0_91\bin\java.exe" -jar d:\wemo-bridge\wemo-bridge.jar
                      15:46:28.183 [main] DEBUG org.eclipse.jetty.util.log - Logging to Logger[org.eclipse.jetty.util.log] via org.eclipse.jetty.util.log.Slf4jLog
                      15:46:28.292 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@53bd815b added {qtp1694819250{STOPPED,8<=0<=200,i=0,q=0},AUTO}
                      15:46:28.339 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - HttpConnectionFactory@12bb4df8{HTTP/1.1} added {HttpConfiguration@4cc77c2e{32768,8192/8192,https://:0,[]},POJO}
                      15:46:28.370 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {org.eclipse.jetty.server.Server@53bd815b,UNMANAGED}
                      15:46:28.386 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {qtp1694819250{STOPPED,8<=0<=200,i=0,q=0},AUTO}
                      15:46:28.401 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@2437c6dc,AUTO}
                      15:46:28.417 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {org.eclipse.jetty.io.ArrayByteBufferPool@383534aa,POJO}
                      15:46:28.433 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {HttpConnectionFactory@12bb4df8{HTTP/1.1},AUTO}
                      15:46:28.464 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{HTTP/1.1}{0.0.0.0:0} added {org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@7382f612,MANAGED}
                      15:46:28.480 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@53bd815b added {ServerConnector@299a06ac{HTTP/1.1}{0.0.0.0:9700},AUTO}
                      Exception in thread "main" java.lang.NullPointerException
                              at com.unrelatedlabs.wemo.WemoBridge.main(WemoBridge.java:60)
                      Linux Ubuntu 16.04 with java 1.8.0_91:

                      Code:
                      bucksobs01:~$ java -jar wemo-bridge.jar
                      15:53:40.618 [main] DEBUG org.eclipse.jetty.util.log - Logging to Logger[org.eclipse.jetty.util.log] via org.eclipse.jetty.util.log.Slf4jLog
                      15:53:40.649 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@53bd815b added {qtp1694819250{STOPPED,8<=0<=200,i=0,q=0},AUTO}
                      15:53:40.666 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - HttpConnectionFactory@12bb4df8{HTTP/1.1} added {HttpConfiguration@4cc77c2e{32768,8192/8192,https://:0,[]},POJO}
                      15:53:40.669 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {org.eclipse.jetty.server.Server@53bd815b,UNMANAGED}
                      15:53:40.670 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {qtp1694819250{STOPPED,8<=0<=200,i=0,q=0},AUTO}
                      15:53:40.670 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@2437c6dc,AUTO}
                      15:53:40.671 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {org.eclipse.jetty.io.ArrayByteBufferPool@383534aa,POJO}
                      15:53:40.671 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{null}{0.0.0.0:0} added {HttpConnectionFactory@12bb4df8{HTTP/1.1},AUTO}
                      15:53:40.675 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - ServerConnector@299a06ac{HTTP/1.1}{0.0.0.0:0} added {org.eclipse.jetty.server.ServerConnector$ServerConnectorManager@7382f612,MANAGED}
                      15:53:40.675 [main] DEBUG o.e.j.u.component.ContainerLifeCycle - org.eclipse.jetty.server.Server@53bd815b added {ServerConnector@299a06ac{HTTP/1.1}{0.0.0.0:9700},AUTO}
                      Exception in thread "main" java.lang.NullPointerException
                              at com.unrelatedlabs.wemo.WemoBridge.main(WemoBridge.java:60)
                      Is there a certain java version that is needed to get this running?

                      Comment


                        #12
                        This is the version I am running on Raspbian (pretty sure I had issues trying to get this to work under Ubuntu if memory is correct). I recommend using Debian 8.

                        java version "1.8.0_65"
                        Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
                        Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

                        Comment


                          #13
                          Just came across this thread. I may look into setting up the bridge on an ubuntu laptop I have just sitting there. I only have one wemo switch and probably won't get more but I do have the Wemo Mr. Coffee. Would be nice to just have local control rather than having to use IFTTT

                          Comment


                            #14
                            Has anyone gotten this working? Is it stable

                            I was wondering if there are other people that have gotten this working. Also, cytec and anyone else that may have gotten this to work -- is it stable? It seems that the wemo bridge library you linked to has not been updated in a while and I am not sure it is actively being supported.

                            Furthermore, the wemo bridge library says "hacked in lifx-java, needs refactoring but should be functional". Does that mean that I should install lifx java first (https://github.com/timothyb89/lifx-java) and install this over it?

                            The lifx-java library seems unfinished and unstable itself.

                            Also it says it needs refactoring!? I am not a programmer, but this sounds like it needs rewriting.

                            So, in general, is this something that a non-programmer like me should even attempt? I am not doing this merely for experimentation I want to have a stable, functional home automation system.

                            (By the way, I do not wish to imply any criticism to the people that have written and provided these libraries to us for free. I am thankful there are people doing this stuff, even if the libraries are not perfectly supported. I just want to make sure that I know what to expect. )

                            Comment


                              #15
                              Getting the same error as above running java version 1.8.0_65. Any ideas or suggestions?

                              Thanks,
                              Ben

                              Comment

                              Working...
                              X