exec-Binding: no execution

I am a absolute beginner in openhab2 and linux;
tried to find out a solution for 2 days, but no success.

My setup is:
one raspberry pi with openhabian
one additional raspberry pi as testmaschine. On this maschine I can run a python-script, which turns (via a relais and gpio) a lamp on and off.
My plan is, to switch the light via openhab.

I tried 2 different ways:

  1. via exec-Binding:

    sitemap lamptest1 label=“TestSitemap1 (Exec)”
    Switch item=Light_Buro label=“Test-Light” icon=“light”

    // Path and File /etc/openhab2/items/lamptest1.items
    Switch Light_Buro “Test_Light” { channel=“exec:command:testlight:run” }

    Thing exec:command:testlight [ command=“ssh pi@ sudo python /home/pi/an.py %2$s”, interval=0, autorun=true ]

  2. via executeCommandline:

    sitemap lamptest2 label=“TestSitemap2 (executeCommand)”
    Switch item=Light_in_buro label=“Buro Testlight”

    Switch Light_in_buro

    rule "Testrule"
    Item Light_in_buro received command
    executeCommandLine(“ssh pi@ python /home/pi/an.py”)

I can run the script successfull from the commandline of the openhabien-pi via “ssh piⓐ python /home/pi/an.py” (and also via commandline on the testmaschine itself):
The light goes on/off as intended.

But no result, when I try to switch it via iPhone/Basic UI.
Via Basic UI comes a message: “Offline: waiting for connection to become available”

openhab-Log-File looks good for me:
2017-08-22 14:40:25.530 [ItemCommandEvent ] - Item ‘Light_Buro’ received command ON
2017-08-22 14:40:25.543 [ItemStateChangedEvent ] - Light_Buro changed from OFF to ON
2017-08-22 14:40:27.807 [ItemCommandEvent ] - Item ‘Light_Buro’ received command OFF
2017-08-22 14:40:27.817 [ItemStateChangedEvent ] - Light_Buro changed from ON to OFF
2017-08-22 14:40:33.502 [ItemCommandEvent ] - Item ‘Light_in_buro’ received command ON
2017-08-22 14:40:33.514 [ItemStateChangedEvent ] - Light_in_buro changed from OFF to ON
2017-08-22 14:40:35.592 [ItemCommandEvent ] - Item ‘Light_in_buro’ received command OFF
2017-08-22 14:40:35.610 [ItemStateChangedEvent ] - Light_in_buro changed from ON to OFF
2017-08-22 14:40:42.967 [ItemStateChangedEvent ] - network_device_192_168_178_63_time changed from 11.644148 to 4.520493
2017-08-22 14:40:43.647 [ItemStateChangedEvent ] - network_device_192_168_178_52_time changed from 7.822609 to 5.116114

2017-08-22 14:40:33.588 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine 'ssh piⓐ python /home/pi/an.py’
2017-08-22 14:40:35.629 [INFO ] [lipse.smarthome.io.net.exec.ExecUtil] - executed commandLine ‘ssh piⓐ python /home/pi/an.py’

Any idea?
Thanks a lot in advance!


Just a note that the openHAB process runs as user openhab. Check if you can run the ssh commandline using this user from your shell.

Thanks a lot for your help.
I will go through your post step by step in the next days.