I am trying to press a button in openhab (on my Raspi) in order to set my Windows remote computer to sleep.
If I use the command remotely on ssh from my pi it works fine, but I am not able to get it running via Exec Binding on the same machine.
What I did:
I installed Openhabian on my Raspbian Stretch installation. The default user is pi and openhabian created a openhab user.
When I SSH into the Raspbian (with the user pi) I am able to shutdown my Remote windows computer. Therefore I set up KeyAuthentication for my user pi. Then I was able to run the command
ssh username@ip /mnt/c/Windows/System32/rundll32.exe /C powrprof.dll,SetSuspendState 0,1,0
Thats working fine because of the installed WSL on Win10.
But when I try to use the exec binding in OH with the thing
Thing exec:command:MyComputer [command=“sudo ssh username@ip /mnt/c/Windows/System32/rundll32.exe /C powrprof.dll,SetSuspendState 0,1,0”, interval=0, autorun=false]
then it is not working at all. My guess would be that exec binding is using the user openhab which does not have a key authentication to my remote machine?
Does somone have any idea how to get it running? Thanks!