openhab controlling rc switch on raspberry pi



  • Hi guys,

    I would like to control a rc switch using my raspberry pi where openhab is also hosted. I already configured everything and it is working fine from shell e.g. as user pi I have to enter

    sudo /opt/rcswitch-pi/send 00001 5 1
    

    to turn the rc switch on. Now I tried to integrate this into openhab, without success. I added the following line to my home.items file:

    Switch Light_FF_Test 		"Test Funksteckdose"	(FF_Test, Lights)	{exec="OFF:sudo /opt/rcswitch-pi/send 00001 5 0, ON:sudo /opt/rcswitch-pi/send 00001 5 1"}
    

    I see openhab gets the command (log file) but it does not switch the rc switch. Any suggestions? Thank you!!


  • Hero Member

    Is the user, that runs OH allowed to sudo?



  • For testing purposes I use the root user, I guess he should be able to sudo!? But I'm a total Linux noob...



  • Did you install the exec addon?


  • Hero Member

    If OH is running as root you don't need to sudo. Haven't tried to sudo as root yet. 🙂
    If OH is running with a deamon user, which certainly makes sense for production, this user may not be allowed to sudo.



  • @Jan-Gatzke said:

    Did you install the exec addon?

    Thank you Sir!

    was asking in a different forum as well, nobody had the idea to install this binding first and I didn´t know a binding is needed for execution of commands...

    Well then, problem solved 👍 🙂


 

271
Online

8.9k
Users

9.6k
Topics

100.8k
Posts