I’m new to OpenHAB and using the GPIO pins on the Raspberry Pi. I set up a simple page up to do an LED on/off test. The page comes up as expected but the LED doesn’t turn on when I select to turn it on. Here are all the steps I took while installing OpenHAB on a fresh install of Raspbian
-
sudo apt-get update
-
sudo apt-get upgrade
-
java -version
*(java version 1.8.0_65 was installed) -
wget -qO - ‘https://bintray.com/user/downloadSubjectPublicKey?username=openhab’ | sudo apt-key add -
-
echo “deb http://dl.bintray.com/openhab/apt-repo stable main” | sudo tee /etc/apt/sources.list.d/openhab.list
-
sudo apt-get update
-
sudo apt-get install openhab-runtime
-
sudo /etc/init.d/openhab start
Returned message "[ ok ] Starting openhab (via systemctl): openhab.service." -
sudo echo 4 > /sys/class/gpio/export
-
sudo cp /etc/openhab/configurations/openhab_default.cfg /etc/openhab/configurations/openhab.cfg
-
sudo leafpad /etc/openhab/configurations/openhab.cfg
uncommented “gpio:sysfs=/sys” and "gpio:debounce=10" -
sudo apt-get install libjna-java
version 4.1.0-1 was installed -
sudo apt-get install openhab-addon-binding-gpio
-
sudo leafpad /etc/default/openhab
changed USER_AND_GROUP=openhab:openhab to USER_AND_GROUP=root:root)
changed JAVA_ARGS= to JAVA_ARGS=-Djna.boot.library.path=/usr/lib/jni -
sudo leafpad /usr/lib/systemd/system/openhab.service
changed User and Group from openhab to root -
sudo touch /etc/openhab/configurations/sitemaps/home.sitemap
-
sudo touch /etc/openhab/configurations/items/home.items
-
sudo leafpad /etc/openhab/configurations/items/home.items
inserted the following text
//------------------------------------------------------------------------
// Raspberry Pi
// GPIO
//------------------------------------------------------------------------
Switch LED{ gpio=“pin:4” } -
sudo leafpad /etc/openhab/configurations/sitemaps/home.sitemap
inserted the following text
sitemap home label=“Home”
{
//------------------------------------------------------------------------
// Raspberry Pi
// GPIO
//------------------------------------------------------------------------
Frame label=“Rasperry Pi GPIO”
{
Switch item=LED
}
}
As I stated the page opened as expected but when I try to turn the LED on nothing happens. The following error can be found in the log file
"[ERROR] [.o.b.gpio.internal.GPIOBinding] - Error occured while creating backend object for item LED, exception: /sys/class/gpio/export"
To make sure the LED was wired up correctly I ran “echo high > /sys/class/gpio/gpio4/direction” and it fired right up
Can anyone tell where I went wrong?