Exec command from RPI to Windows not working

Hello,

i’m trying to start and stop applications on my HTPC with the exec binding.
Openhab 1.8 is running on a Raspberry PI.
My HTPC is running Windows 10 with a SSH Powershell Server.

From a ssh shell on the RPI with my PI User the commands are working fine. For example:
sshpass -p "htpcpassword" ssh username@htpc kill -processname Steam

So i created a killsteam.sh file in /opt/openhab/configurations/scripts

and a item:
Switch HTPC_Steam "Steam starten" (Status,Network,HTPC) {exec="*:/opt/openhab/configurations/scripts/killsteam.sh"}

Can somebody help me to solve this problem?

Create a rule and call your exec command using executeCommandLine (cmd, timeout)and log what gets returned. This is the only way to see what error message is being printed. In my experience 99% f the time problems running ssh through the exec binding is caused by permission problems on the openhab user. My most recent problem was caused by the openhab start script changing the permissions on the files in ~openhab/.ssh.

1 Like

The idea with the log was great. It’s working now.

For those who are intressted:

rule "Stop Steam"
when
Item Switch_KillSteam received command
then 
var String response = executeCommandLine("/usr/bin/sshpass -p password ssh -o  StrictHostKeyChecking=no user@htpc kill -processname Steam", 2000)
logInfo("Kill_Steam", response)
end