Wake-on-LAN via OH2.5 network binding?

The network binging provides a Wake-On-LAN action, but I suspect I’m not calling it correctly.

My intent is to send a WoL packet when an item state changes to ON. I can’t find a single forum example of WoL via the network binding to compare (I understand that this was previously provided in a more popular, dedicated 1.x WoL binding).

It would seem like I am either not calling the binding’s actions correctly, or that binding is not providing the action. Can anyone show me the error of my ways or another example of using this action?

My rule:

val actions = getActions("network","network:servicedevice:46a49637")
rule wake
        Item PC changed from OFF to ON

The rule is triggering, but I am getting the error:

[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'wake': 'sendWakeOnLanPacket' is not a member of 'org.eclipse.smarthome.core.thing.binding.ThingActions'; line 11, column 2, length 29

The Thing (“Corsair”) that should be receiving the wake-on-lan packet is configured via PaperUI, but I’ve added the macAddress parameter via the REST API (changed from actual mac in the json excerpt below).

“label”: “Corsair”,
“configuration”: {
“hostname”: “”,
“macAddress”: “aa:bb:cc:dd:ee:ff”,
“port”: 445,
“refreshInterval”: 60000,
“retry”: 1,
“timeout”: 4000

“UID”: “network:servicedevice:46a49637”,
“thingTypeUID”: “network:servicedevice”,

  • Platform information:
    • Hardware: Raspberry Pi4
    • OS: openhabian (Raspian Linux 10)
    • Java Runtime Environment: 1.8.0_265
    • openHAB version: 2.5.8(release)

actions is a reserved work I think. And anyway, it’s not a good name for that variable as it doesn’t represent all actions, it represents only the actions associated with network:servicedevice:46a49637.

I believe it is best practice to acquire the action from inside the Rule, not globally. The context may not be fully ready or the Things may not be fully ready when the Rule first loads . The Thing may change after the Rule loads causing actions to be stale an no longer point at the working Thing’s actions.

Looks like the example provided in the documentation uses actions as the val name, though it does seem to define it locally, rather than globally.

It was recently added and will be available in 2.5.9.
If you want to try it today you can use a snapshot build. :slight_smile:

See also:

Ahh, I had seen that thread but missed that it was for 2.5.9. In that cae, I will wait for the release to catch up to the documentation on that page. Thanks for the quick reply!

This is awesome - I did think ‘I swear that wasn’t there a month or so ago when I installed the WoL binding!’

Are you able to show an example implementation using Jython rules? (Apologies for the slight hijack)

That won’t take long (see 2.5.8 announcement):

The WoL add-on was the only missing remaining add-on for me in OH3. Since the new action will be available in 2.5.9 you can already migrate to it whenever you want in advance of all work that comes with upgrading to OH3.

I don’t use Jython myself but it will probably be similar to:

1 Like

For completeness, once the network Thing has been setup with a macAddress, this works in Jython:

actions.get("network", "network:pingdevice:devicename").sendWakeOnLanPacket()

as @wborn predicted!


sorry, I’m a little lost.
I used the wol feature with a sitemap and alexa voice controlled.
I created a thing and a the rule. When I run the rule manually I the WOL package is send.
But I’m not able to make a connection to a thing and the created thing for network:servicedevice isn’t syncable to the cloud.

Can any one please give me hint, what is missing here?

You should review the concepts section of the docs again. Sitemaps/Alexa and all the rest interact with Items. You usually trigger a rule using Item events. You make Items available to Alexa, not Things.

So you need to link a Switch Item to the WoL Channel on the Network Thing. Then you can put that Item on your sitemap, configure it to be used with Alexa, and send a command to it from a rule.

I’m sorry, of course I created an item.I’m not shure how to link the switch item to the WoL. Can I find anywhere an example? In the docs I can’t find anything helpful

Hi Stephan,
I struggled with this as well, the items aren’t the only thing in play here. Alexa interacts with items, but the network binding (and WoL) uses the configuration of the thing.
I have an example below because I certainly wished I had something to go off of when I attempted this. I’m sure I didn’t do this all the proper or cleanest way, and all examples are provided with those major caveats. That said, I did four things:

  1. Create an item called PC, and hook that up to Amazon (it seems you have done this part).

  2. Create a rule that when the PC item is updated, to trigger the WoL packet:

val netactions = getActions("network","network:servicedevice:46a49637")
rule PC
        Item PC received update
  1. Create a switch item associated with the mac address (Looking back I don’t think this was required, but it was something I created when figuring this out)
    Switch Corsair_Online “Corsair” { wol=“” }

  2. Add the macAddress to the Thing configuration via the rest API, and hook it up to the “online” channel.

“statusInfo”: {
“status”: “ONLINE”,
“statusDetail”: “NONE”
“editable”: true,
“label”: “Corsair”,
“configuration”: {
"hostname": “”,
"macAddress": “aa:bb:cc:dd:ee:ff”,
“port”: 445,
“refreshInterval”: 60000,
“retry”: 1,
“timeout”: 4000
“properties”: {
“icmp_state”: “Disabled”,
“dhcp_state”: “off”,
“presence_detection_type”: “”,
“arp_state”: “Disabled”,
“uses_ios_wakeup”: “No”
"UID": “network:servicedevice:46a49637”,
“thingTypeUID”: “network:servicedevice”,
“channels”: [
“linkedItems”: [],
“uid”: “network:servicedevice:46a49637:online”,
“id”: “online”,
“channelTypeUID”: “network:online”,
“itemType”: “Switch”,
“kind”: “STATE”,
“label”: “Online”,
“description”: “States whether a device is online or offline”,
“defaultTags”: [],
“properties”: {},
“configuration”: {}

End result in the logs looks like:

2021-02-17 14:34:59.914 [INFO ] [twork.internal.WakeOnLanPacketSender] - Wake-on-LAN packets sent (MAC address: aa:bb:cc:dd:ee:ff)