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.
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.
[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
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
@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.
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.
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.