[SOLVED] Wake on Lan Binding -> Shutdown is not working

Hi Guys,

i´m setting up my openhab and i´m able to start my Win10 PC with voice over WakeOnLan.
But: The shutdown isn´t working for me. I´m using this install guide to get it to work:

But neither of both of Shutdown examples worked for me.

What did i miss? Can anybody push me in the right direction? Did a lot of research, but found nothing for my issue.

Thanks

May (can) you please post your configuration files (like *.items, etc.).
I’ve been polite enough! If the binding says “wake”, why would you try to “sleep”, “shutdown”?
Have you read this, whith the explanations on how to link an item to multiple channels/bindings)?
Or maybe, you should start over.

If you followed the examples, you might have been mislead. The shutdown part of the examples is not belonging to the WOL Binding, but using Exec Binding. As I see, the examples are mixed, the first one is Linux, the second Windows. So first you have to get the RPC call working, which is something you have to enable on your Windows machine, not openHAB related.

It might be the issue that your openHAB user doesn’t have rights to exec the shutdown command on the machine.
For Windows you can configure this via GPO, or put the user in the Administrators group.

I´ve installed the binding-exec - 2.4.0 and used the second exampe. My item look like this

Switch dz_networkPC "Win10 Rechner" (gPCs) { wol="192.168.1.255#XX-XX-XX-XX-XX-XX", exec=">[OFF:net rpc shutdown -C MESSAGE -I 192.168.1.22 -U Win10User%%Win10Passwort -f -t 0]"}

I activated the remote desktop access.

Didn´t work as well.

If you send the RPC command directly from command line (not trough openHAB) does it function then?
Is the command send from a Windows or Linux device?

i tried from the raspberry pi where openhab is installed (from the command line) and got this:

Could not connect to server 192.168.1.22 The username or password was not correct.

the username and passwort is definitiv from the win10 pc, maybe the Username%%passwort syntax is wrong?
do i need the two % symbols?

So I did a lot of research. I activate Remote Desktop at WindowsSymbol/Settings/System/Remotedesktop and added under User Accounts the Administrator Accound and my own Account.

Then i found this code

net rpc -S 192.168.1.22 -U User%Passw shutdown -t 1 -f

it looks different from the code in the openhab documentation

net rpc shutdown -C MESSAGE -I 192.168.1.22 -U USER%%PASSWORD -f -t 120

and i tried the new code in the command line from my openhab raspberry pi and my Win10 dit shut down. It worked.

After i inserted the new code in the item.item List it dit not worked.
here are my new code:

{ wol="192.168.1.255#E0-D5-5E-61-A3-0B", exec=">[OFF:net rpc -S 192.168.1.22 -U User%Passw shutdown -t 1 -f]"}

So now i know the code works. But why not with openhab?

Wait, if you installed the 2.4 version of the exec binding then your Item config is all wrong. See https://www.openhab.org/addons/bindings/exec/

This is why it’s a really bad idea to include examples that use other bindings in a binding’s docs. Things change but the docs don’t get updated.

Oh man, i´m such an idiot. I solved it after getting some distance from this problem and getting back a few days later.

First off all: I named the thing file wrong. forgot the s at end of .things
After that i used the help from: https://www.openhab.org/addons/bindings/exec/

my .things file looks like that:

Thing exec:command:win10martin_shutdown [command="net rpc -S 192.168.1.22 -U
USER%%PASSWORD shutdown -t 1 -f",interval=0, autorun=false]                        

(The double % is very important)

my .items file looks like that:

Switch dz_win10martin_shutdown "Martins Win10 Rechner Shutdown"
(gPCs,gDZ_alles,gDaddelzimmer) {channel="exec:command:win10martin_shutdown:run"}
Switch dz_win10_ausschalter (gDZ_alles,gDaddelzimmer,gPcs)

my .rules file looks like that:

rule "Martins Win10 PC ausmachen"
when
Item dz_win10_ausschalter received command OFF
then
    dz_win10martin_shutdown.sendCommand(ON)
end

Working like a charm.

Thanks for all the help.

Martin