OH3 need help with network binding and wake on lan

Hi,

I am on my Raspi 3B+ and OH3. Now I want to use the network binding of OH3 to wake up my PC. Therefore I tried to get some information from following thread:

Switch state from network binding combined with wake-on-lan action.

  1. I installed the network binding in OH3 using the UI
  2. I created a thing called ‘MiniPC_thing’ also using the UI:

  1. I created an item called ‘MiniPC_item’ using Visual Studio Code:

Switch MiniPC_item "MiniPC_item" {wol="192.168.178.255#B4:2E:99:27:13:77", channel="network:pingdevice:MiniPC_thing:online"}

I set Auto-update to false using metadata, but now I stuck.
I thought if I create an item of type ‘Switch’ I get some switch-icon in the UI what I can use set to on and off for testing - but it just shows ‘OFF’ - no icon that I can really use.
Now I stuck - I don’t know how to get further.

My final goal is to wake up my PC every day at 02:00 AM to do a data backup to external storage.

What I am missing please?

This is old syntax, for the V1 wake-on-LAN binding. It will not work in openHAB 3.

Wake-on-LAN can now be effected through the Network binding. See this section of the documentation on how to achieve this via a rule.

The tutorial that you are using will not work without modification, as it was written for the old v1 binding. See the latter posts in that thread for more information.

OK thanks,

does that mean I have to create a rule like mentioned in the docu?:
And what about the item? Do I still need it in OH3?

And then? - How to get further?
How to get a simple switch (or better a timer) to wake my PC?

Yes

Probably.

Like this one, for example.

Hi,

now I have a simple Switch item and created a rule using OH3 UI:

In the Then section I added a script:

But if I run this script using the 'Run Now (Ctrl-R) inside the OH3 script editor I get following log in frontail:

What I am missing here?

I think it’s trying to interpret your DSL script as javascript.

I found it by myself now, I chose the wrong script type, one must use ‘Rule DSL’:

Now it is working

1 Like

In Javascript / ECMAScript it would be:

var wolAction = actions.get("network","network:pingdevice:devicename");
wolAction.sendWakeOnLanPacket();

:wink:

1 Like