Just installed the latest stable build of openhab2 on a new VM; going to rebuild openhab from scratch.
I’m trying to rewrite everything.
I installed the WOL and exec binding.
Trying to get WOL working first.
ON, seems to work.
OFF, does not; it is a windows machine.
I know windows is configured correctly, it still works in other apps and my 4 year old instance of openhab. The difference between then and now is it looks like I don’t need a rule now.
All the code is basically in the item.
Prior to this, in the old openhab instance, i had a rule that would run when the switch was turned off:
executeCommandLine(“net rpc shutdown -I 172.16.1.15 -U User%Password”)
If i send this in from the terminal:
net rpc shutdown -f -t 0 -C ‘message’ -U user%password -I 172.16.1.91
The windows machine DOES shutdown.
I also ran that from the command line with sudo -u openhab and it worked.
I’ve literally tried everything; looked at that exec binding white list page…I can’t make heads or tails out of it. Item: Switch WOLWorkVMs2 “Work Two” [ “Switchable”] { wol=“172.16.1.255#F0:4D:A2:36:5B:8E”, channel=“exec:command:NetRpcWorkVMs2Off:run” }
If i do this and make a “thing” : Thing exec:command:NetRpcWorkVMs2Off [command=“net rpc shutdown -I 172.16.1.91 -U user%%pw -f -t 0”, interval=0, autorun=false]
and i toggle the switch, it goes on off on off and i finally see something in the log:
Tried to execute ‘net rpc shutdown -I 172.16.1.91 -U user%%pw -f -t 0’, but it is not contained in whitelist.
However i don’t know what exactly to put into that file; i’ve tried numerous combinations of things. also no idea why the switch goes ON and OFF when i push it once.
This is not going to help for switching off - WOL = Wake On Lan, it never turns anything off.
The message tells you what it was looking for, have you tried that? You have to put the whitelist file in the right place as well.
Because the exec Thing run channel tells you what the binding is doing, as it explains in the docs. When the script starts to run, the channel turns on. When the script exits (probably just a few milliseconds later), the channel turns off.
You will not be able to use this channel to represent the on/off state of some remote PC
I guess the only thing i can ask at this point is are there clear examples of a thing defined as a command, like rpc shutdown and how does one define that in that file…because i’ve already exhausted numerous amounts of combinations of me trying after reading those posts.