Possible enhancement to WOL plugin

I’m new to Vera, and the libraries that ship with it, but I was looking at some example luup plugins, as I am about to write my own.

Looking at the WOL plugin, instead of having to install the ‘etherwake’ package, would it be possible to use UDP and the Lua socket libraries to do a native WOL magic packet?

I’m not sure who is currently maintaining it, but I thought I’d throw the idea out there - would make the plugin much more accessible if it carried no dependencies.

This is one example I found on the web (http://www.indigorose.com/forums/threads/25657-Wake-On-Lan-with-LUAsocket-demo):

 function Wol (mac, BroadcastAddress) 
 
   -- convert MAC adress, every 2 Chars (7-bit ASCII), to one Byte Char (8-bits)
   local macX = "";  -- will contain converted MAC
   for n=1, 12, 2 do 
     macX = macX .. string.char(tonumber(String.Mid(mac,n,2),16)); 
   end; 
   
   -- Create Magic Packet 6 x FF , and at least 16 x MAC adress
   local magicpacket = string.rep(string.char(255), 6) .. string.rep(macX, 16); 
 
   -- Send MagickPacket (twice to be sure since it's UDP) to LAN broadcast adress
   local udp = socket.udp(); 
   for n=1, 2 do 
     udp:sendto(magicpacket, BroadcastAddress, 9); 
   end; 
   udp:close(); 
   
end;

Also, is there a process for a plugin to make its way into the standard firmware? A WOL plugin seems very useful for a home automation controller to have as standard.

I would like to see this! I thought I remember seeing a post somewhere about a Zwave USB stick that could wake a PC etc but cant find it now!

I have another solution that I’m looking into at the moment thats a bit dirty but should work! Will post back if it works for me!

[list]
This worked for me:

[ul][li]In your PC BIOS, enable PC wake up after AC power fail.[/li]
[li]Plug your PC into a Zwave appliance module or similar (mine was already on a wall outlet anyway because of phantom power).[/li]
[li]Create a new Scene called something like “PC on”.[/li]
[li]In the commands for the scene create a command that turns the appliance module off then after 5 seconds turn back on.[/li][/ul]

Enjoy the new found laziness of not having to walk to your PC to turn it on :slight_smile:

Joking aside, my PC is upstairs and connected via a HDMI cable to a TV downstairs; it now saves walking upstairs to turn it on when I switch my Matrix switch to the PC :slight_smile:

@Klunket, thanks for the tip, I was planning on having to retire the plug since MCV no longer will provide support for Veras that have had settings changed outside of their UI (ie, can’t install OpenWRT packages). I’ll look into updating the plugin to include this code.

Happy to help. Let me know if you need help testing or similar.

Some testing help would be great. I’m currently testing UI4 and there seem to be issues with using plugins in the current build. I have attached the I_WOL.xml file with including the modifications you suggested (the device and service files are unchanged), I have not been able to do any testing, so anything you can tell me would be great.

Ok, maybe i’m just a little slow,but how do I get this installed on UI3?

Not sure, I’m skipping over UI3.

Any luck with gettin this up and running?

I’m sorry, my wife is pregnate and things have been busy at work, so I have not really had time to look into this yet.

Check the latest version of this plugin, it should offer more flexibility. If I have time I will try to extend it further so it won’t depend on additional packages.

Hi All.

Does anyone have any step by step instructions on how to install WOL.

Any help would be greatly received.

Cheers

m0jon