Wake-on-LAN

logo

This library adds a block to wake a Network device with a Wake-on-LAN packet. You need the Network binding installed and a configured device Thing. If you wish to use the MAC method, you should also provide the MAC address in the thing configuration.

Blocks

image

This block will send a Wake-on-LAN packet to the specified network device, which you can select in a popup by clicking inside the thing block. Only choose a Network device when picking the thing.
Watch out for log messages if the operation doesn’t seem to work, for instance:

java.lang.IllegalStateException: Cannot send WoL packet because the 'macAddress' is not configured for network:servicedevice:mycomputer

Changelog

Version 0.1

  • initial release

Resources

uid: wol
tags: []
props:
  parameters: []
  parameterGroups: []
component: BlockLibrary
config:
  name: Wake-on-LAN
slots:
  blocks:
    - component: BlockType
      config:
        type: send_wol
        message0: send a Wake-on-LAN packet via %1 to wake %2
        args0:
          - type: field_dropdown
            name: METHOD
            options:
              - - MAC
                - Mac
              - - IP
                - Ip
          - type: input_value
            name: DEVICE
        previousStatement: ""
        nextStatement: ""
        inputsInline: false
        colour: 0
        tooltip: ""
        helpUrl: ""
      slots:
        code:
          - component: BlockCodeTemplate
            config:
              template: >
                {{utility:things}}.getActions('network', {{input:DEVICE}}).sendWakeOnLanPacketVia{{field:METHOD}}();
        toolbox:
          - component: PresetInput
            config:
              name: DEVICE
              type: oh_thing
              shadow: true
  utilities:
    - component: UtilityJavaType
      config:
        name: things
        javaClass: org.openhab.core.model.script.actions.Things
6 Likes

Thank you very much. I‘m using it already and it‘s working perfectly :slight_smile:

1 Like

Glad to hear it! :smiley:

1 Like

Hi Yannick,

thank you very much for this binding, thats very cool and helpfull.
I have one problem and i’m stuck with it. I have a Ubuntu server which is not necessary to run 24/7. With my Openhab3 i would like to start it, which is working under some circumstances as followed.
I have a Openhab 3 Instance (3.2.0) running at a windows server VM on Ubuntu 18.04, installed via openhabian, which is running fine and without any problems so far. Actually i updated to 3.3 but the Problem seems to stay.
When i shut it down and send the “magic Packet” via Openhab within a few Minutes after the shutdown, the WOL works perfectly fine and the server start booting.
If i wait for example for more then 30 minutes and send the WOL packet from openhab, the server does not wake up any more.
If i send the WOL package from my pfSense firewall or straight from the router 30minutess later or more, the server respond straight ahead and start booting. I don’t have any error messages inside the logs. I’ve implemmented the IP and MAC magic packet option inside the same rule to try both at the same time, but nothing changed. I’ve already tryed to send the magic packets multiple times with a delay in between, but no success. I’ve configured the server as a networkdevice, and selected port 9 inside the networkdevice binding settings to make sure the packet will send on the right port.
Do you have any idea or recommended settings for the binding i could try?
I would appreciate you help and/or feedback on that.

Regards Marcel

Hi Marcel,

Unfortunately I cannot help you with this issue, as this is just a Blockly script block that calls the Rule Actions of the Network binding:

You might want to open an issue on GitHub (Issues · openhab/openhab-addons · GitHub) to have the right people be aware of it and eventually have a look at it.

Thank you very much Yannick for you’re reply.
I will do it like you said.
Regards Marcel