Hello,
First of all I’m new to openhab so please stay with me if I say something stupid.
My problem is controlling a relay by gpio on a raspberry pi 3.
The relay is connected on gpio 29. I can control the relay by using
gpio write 29 0
gpio write 29 1
Items file contains
Switch RaspiRelay{ gpio="pin:29" }
Sitemap file contains
sitemap standard label="Home" {
Frame label="Rasperry Pi GPIO"
{
Switch item=RaspiRelay
}
}
Nothinh happens when I press the switch. I noticed that running gpio from the terminal as user openhab doesn’t work also.
su -c "gpio write 29 1" - openhab
So I added openhab user to gpio and root groups, but it still doesn’t work.
Also I added
USER_AND_GROUP=root:root
in /etc/default/openhab2 and
User=root
Group=root
in /usr/lib/systemd/system/openhab2.service, but it still doesn’t work.
Karaf log doesnt show any errors. When I press the switch it shows:
22:52:11.872 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'RaspiRelay' received command OFF
22:52:11.882 [INFO ] [marthome.event.ItemStateChangedEvent] - RaspiRelay changed from ON to OFF
22:52:25.483 [INFO ] [smarthome.event.ItemCommandEvent ] - Item 'RaspiRelay' received command ON
22:52:25.495 [INFO ] [marthome.event.ItemStateChangedEvent] - RaspiRelay changed from OFF to ON
I’m lost, I cant figure it out what I’m missing.