Rob_Pope
(Rob Pope)
1
I’ve migrated to OH2 from 1.8 and all is going well.
In 1.8 I had an Exec binding which called RCSwitch to turn on some 433Mhz power sockets.
In OH2 I’ve installed the Exec 1.9.0.b4 through PaperUI.
My items file:
Switch BathroomDehumidifier “Power” {exec=">[OFF:sudo /home/pi/config/wiringpi/switchOff.sh 3 1] >[ON:sudo /home/pi/config/wiringpi/switchOn.sh 3 1]"}
My sitemap:
Switch item=BathroomDehumidifier
If I call the command in the items file the switch works, but not from the OpenHAB UI.
Any ideas? Is it configuration or permissions causing the problem?
jflarente
(Jean-Francois Larente)
2
Do you see anything happening in the logs?
Rob_Pope
(Rob Pope)
3
Nothing in /var/log/openhab2/openhab.log
However, if I call service openhab2 status I see:
openhab : command not allowed ; TTY=unknown ; PWD=/var/lib/openhab2 ; USER=root ; COMMAND=/home/pi/config/wiringpi/s...hOn.sh 3 1
Rob_Pope
(Rob Pope)
4
It was permissions.
Calling sudo visudo and adding
openhab ALL=NOPASSWD: /home/pi/config/wiringpi/switch*
Got things working
jflarente
(Jean-Francois Larente)
5
Excellent - don’t you like when you get to answer your own questions? 
1 Like
Rob_Pope
(Rob Pope)
6
I’d added the user hab to that file, and pi for good measure. Only in the service log did I see that it was referencing the user “openhab”