Windows PC remote control (Shutdown, ...)


i would like to get this running on my HTPC do you have any tutorial info on the process to get the Java files to run on windows? I have my MQTT broker set up on a PI3 running openhab but I am confused as to setting up the winthing files on my HTPC. There is very little information about the actual install on the Github page. Let me know if you could help with the necessary command lines. Thanks

Create a bat file, then link it in the Autostart start menu subfolder. The bat contains something similar to:

start javaw -jar -Dwinthing.brokerUrl=tcp://openHABianPi:1883 -Dwinthing.brokerUsername=openhab -Dwinthing.brokerPassword=abcdef -Dwinthing.topicPrefix=winthing-pc winthing-1.1.0.jar

I wanted to write a tutorial on the complete topic of interacting with a windows PC. I did not do that yet :sweat:

You need to “escape” the percent sign by putting another percent sign in front of it. I know it sounds weird but it’s a programming thing with special charters.

So it would be command=“net rpc shutdown -I 192.x.x.x. -U MyUser%%SuperSecret”

You can look at the conversation on Stackoverflow for more info.

Good Luck,

Ps. This might be what your looking for.

Sorry to ask but where do i get this .jar files ??

'cause when i go to the url link to Github all files I get there now i get in a .zip file and theres a lot of files in that .zip file but no winthing.jar files…Im confused and new to this but I really love openhab2 and got a lot of sonoff stuff working with my setup today and a mqtt server on raspberry pi 3 and feel that the next step now I want to control some software on my windows 10 machine.



I assume I can only use Winthing in my own home LAN as Winthing does not support encryption or the 8883 ports of MQTT over SSL, right? All passwords are sent as plain text?

So for all remote control applications over internet what to choose else?

Hi everyone,

I was just thinking about the newly added functionality of WSL (Windows Subsytem on Linux) on Windows. Do you think there is a way to use Openhab on the raspberry Pi to remotely set the Windows system to sleep mode?

I am no IT specialist but I thought about something like
–> press Openhab Button
–> Raspberry is communicating to WSL system on Windows
–> WSL is then setting Windows into sleep mode, maybe through a batch command and using PsShutdown on the Windows machine.

Do you think this would be possible? If yes, could someone please guide me through the steps I need to take?


Hi everyone,
I figured out a way to do it, but I am having issues with the exec binding.
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!

Hy Tom. I would be glad if you could manage to write a little tutorial with examples about how to use this via mqtt.

I allready get the mqtt client running on my win10 PC and it seems to be listen to my mosquitto server at openhabian.
But I´m still cant get an item in OH2 working. I dont know how to create the correct mqtt string/command to run a programm on the target or shut it down.
I tried this in mqtt-fx:
But nothing happend.

Can anyone here assist?

hi guys,
Created small tutorial. check it out

1 Like

Hey there @rhapen =)

I followed your tutorial. I got the MQTT Broker set up on the Pi, the item, the Sitemap and the Rule works. The Rule is sending the commands.
I installed winthing as you described. However I think it is not picking up the commands. I am sending them, got a script (.bat file) in the C:/WinThing folder which works if I manually start it. Do you have any idea how to fix this? Do I have to reboot Windows?

And did I understand this correctly that the Pi (Broker) just sends out the commands to everyone in the network and the Client is supposed to pick them up? Nowhere I defined on the Broker side of things where to send the commands to. Is the mistake there?

Thanks! Have a nice day

If anyone stumbles upon this topic as I did (which led me to winthing). I forked winthing and added a few features. You can check it here:


Felix, yes, openhab will send commands to the broker and winthing (client) will pick them up from the broker. Did you check winthing logs? You should have logs folder where winthing.jar is located, maybe winthing can’t connect to the broker or maybe it can’t run the commands (wrong path).


I recently started to use this winthing subscriber with openhab and it works very well. Now is my question if there is a similar way to achive this on an linux machine ubuntu or tinycore linux. I have several streaming units running tinycore linux and would like to be able to shutdown after inactivity and WoL on demand. WoL already works flawless via Network binding.

The methods I’ve seen on the forum is all about net rpc or ssh whre you have to provide username and password which i woulkd prefer to not have to.

NET RPC refuses my connections i ubuntu server 18.04

Read this.

I use execcomand to turn off a remote rpi