For the benefit of others that might have encountered this WEMO2 binding issue I am herewith documenting my solution – I first ensured Java is up-to-date and then reverted to the WEMO 1.8.3 binding. Please note my WEMO devices are on light switches and sockets. See hmerk’s comment above.
I updated my Raspian system (Jessie), installed OpenHAB2 2.4.0 stable release per instructions at https://www.openhab.org/docs/installation/linux.html, and upgraded to Oracle JAVA build 1.8.0_201-b09 as follows:
I started with instructions per this 1st reference: https://raspberrypi.stackexchange.com/questions/45976/how-do-i-update-java-8-in-raspbian
Remove OpenJDK
sudo apt-get purge openjdk*
add digital key
sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com EEA14886
sudo apt-key adv --recv-key --keyserver keyserver.ubuntu.com EEA14886
add packet source
sudo vim /etc/apt/sources.list
add following lines
deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main
Install Java 8
sudo apt-get update
sudo apt-get install oracle-java8-installer
AT THIS POINT I GOT MESSAGE: “Package oracle-java8-installer is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or
is only available from another source”, so I jumped to instructions per this 2nd reference https://gist.github.com/ribasco/fff7d30b31807eb02b32bcf35164f11f
Introduction
The default version of java provided in the latest raspbian images are outdated, so we are going to install from the ppa:webupd8team/java repository instead. Please note that add-apt-repository ppa:webupd8team/java will not work, so we will need to add the repository manually.
Installation
- Create the gpg key file and paste the following lines of text below
nano key.txt
- Add the gpg key
sudo apt-key add key.txt
- Add the repository to /etc/apt/sources.list.d/ and perform an update (THESE ARE RASPIAN COMMANDS!)
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | sudo tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | sudo tee -a /etc/apt/sources.list.d/webupd8team-java.list
sudo apt-get update
- Install Java 8 SDK
sudo apt-get install oracle-java8-installer
- Verify that we have successfully installed java
pi@raspberrypi:~# java -version
java version "1.8.0_161"
Java™ SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot™ Client VM (build 25.161-b12, mixed mode)
Then, based on the 1st reference, I added:
sudo apt-get install oracle-java8-set-default
sudo apt-get purge openjdk*
sudo apt-get purge java7*
sudo apt-get autoremove
check success
java -version
Since I thought my WEMO issue was Java permissions based I also did the following per another thread:
setcap ‘cap_net_raw,cap_net_admin=+eip cap_net_bind_service=+ep’ $(realpath /usr/bin/java)
I then learned from hmerk (Hans-Jörg Merk) via this thread that my WEMO issue was likely a GENA events WEMO2 binding issue and not a Java based issue, so I reverted to the WEMO 1.8.3 binding.
My OH2 system WEMO devices are lights switches and sockets only.
My OH2 services directory (folder) “addons.cfg” file contains the following:
binding = http,mailcontrol,mqtt1,networkhealth1,ntp,wemo1
My OH2 addons directory (folder) contains the org.openhab.binding.wemo-1.8.3.jar file that MUST BE RENAMED to not include the version number - org.openhab.binding.wemo
My OH2 things directory (folder) is empty. I have the directory (folder) but no file in it because I have no other “things” in my system. By experimentation I found OH2 throws errors if the “.things” directory (folder) does not exist.
My OH2 items directory (folder) “.items” file contains the following:
// WEMO Switches WEMO1 Binding Style --------------------------------------------------------------
// Need to define WEMO1 in addons.cfg
// https://github.com/openhab/openhab1-addons/wiki/Wemo-Binding
Switch OHC_WEMO01 "Living Rm Light [%s]" {wemo="Socket-1_0-221341K0101D58", mqtt="<[hsbroker:/OHIB/OHW/54:state:default]"}
Switch OHC_WEMO02 "Family Rm Light [%s]" {wemo="Socket-1_0-221341K0101ECA", mqtt="<[hsbroker:/OHIB/OHW/55:state:default]"}
Switch OHC_WEMO03 "Hot Tub [%s]" {wemo="Socket-1_0-221342K0102BC6", mqtt="<[hsbroker:/OHIB/OHW/56:state:default]"}
Switch OHC_WEMO04 "SPARE [%s]" { mqtt="<[hsbroker:/OHIB/OHW/57:state:default]"}
Switch OHC_WEMO05 "WH Fan [%s]" { mqtt="<[hsbroker:/OHIB/OHW/53:state:default]"}
Switch OHC_WEMO09 "ALARM - Indoor [%s]" {wemo="Socket-1_0-221741K01070C6", mqtt="<[hsbroker:/OHIB/OHW/58:state:default]"}
Switch OHC_WEMO10 "ALARM - Outdoor [%s]" {wemo="Socket-1_0-221741K0105FCB", mqtt="<[hsbroker:/OHIB/OHW/59:state:default]"}
Switch OHC_WEMO11 "Flood - Front Entry [%s]" { mqtt="<[hsbroker:/OHIB/OHW/60:state:default]"}
Switch OHC_WEMO12 "Flood - South Side [%s]" {wemo="Lightswitch-1_0-221642K1300C6F", mqtt="<[hsbroker:/OHIB/OHW/61:state:default]"}
Switch OHC_WEMO13 "Flood - North Side [%s]" {wemo="Lightswitch-1_0-221627K13009A2", mqtt="<[hsbroker:/OHIB/OHW/62:state:default]"}
Switch OHC_WEMO14 "Flood - Backyard [%s]" {wemo="Lightswitch-1_0-221642K1300A96", mqtt="<[hsbroker:/OHIB/OHW/63:state:default]"}
Switch OHC_WEMO15 "Flood - Kitchen [%s]" {wemo="Lightswitch-1_0-221626K13011AE", mqtt="<[hsbroker:/OHIB/OHW/64:state:default]"}
I hope this saves someone much time and frustration.