We have moved at community.getvera.com

Author Topic: Possible enhancement to WOL plugin  (Read 6481 times)

Offline Klunket

  • Sr. Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
Possible enhancement to WOL plugin
« on: June 02, 2010, 11:42:13 pm »
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):

Code: [Select]
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.
« Last Edit: June 02, 2010, 11:45:46 pm by Klunket »

Offline strangely

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3722
  • Karma: +34/-2
  • Vera 1,3 & V light
Re: Possible enhancement to WOL plugin
« Reply #1 on: June 03, 2010, 02:55:51 am »
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!
Kwickset locks, HA01C, HA14C, HA02C, HA03C, HA05C, HA04C, HA07C, HA09C, Aeon HEM, GE 45604, 45606, 45609, ZDP100, VRF01-1LZ, WDTC-20, HA18WD, WDHA-12R, HRDS1, HM-TS001, AC1-ZW, TV-IP110, BL-C210A, LUUP control- EtherRain8, DSC Alarm, HDMI matrix, HR24-200, Panasonic TV, SQblaster

Offline strangely

  • Beta Testers
  • Master Member
  • *****
  • Posts: 3722
  • Karma: +34/-2
  • Vera 1,3 & V light
Re: Possible enhancement to WOL plugin
« Reply #2 on: June 03, 2010, 03:35:13 am »
    This worked for me:
    • In your PC BIOS, enable PC wake up after AC power fail.
    • Plug your PC into a Zwave appliance module or similar (mine was already on a wall outlet anyway because of phantom power).
    • Create a new Scene called something like "PC on".
    • In the commands for the scene create a command that turns the appliance module off then after 5 seconds turn back on.
    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 :)
Kwickset locks, HA01C, HA14C, HA02C, HA03C, HA05C, HA04C, HA07C, HA09C, Aeon HEM, GE 45604, 45606, 45609, ZDP100, VRF01-1LZ, WDTC-20, HA18WD, WDHA-12R, HRDS1, HM-TS001, AC1-ZW, TV-IP110, BL-C210A, LUUP control- EtherRain8, DSC Alarm, HDMI matrix, HR24-200, Panasonic TV, SQblaster

Offline mikeholczer

  • Sr. Member
  • ****
  • Posts: 413
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #3 on: June 03, 2010, 07:17:47 am »
@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.

Offline Klunket

  • Sr. Newbie
  • *
  • Posts: 34
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #4 on: June 03, 2010, 10:30:07 am »
Happy to help. Let me know if you need help testing or similar.

Offline mikeholczer

  • Sr. Member
  • ****
  • Posts: 413
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #5 on: June 06, 2010, 08:14:34 am »
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.

Offline Boyo

  • Full Member
  • ***
  • Posts: 180
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #6 on: June 07, 2010, 08:40:58 pm »
Ok, maybe i'm just a little slow,but how do I get this installed on UI3?
Vera UI4 1.1.1183; Schalge Link Door Handle; HA18WD 3-Way/Single-Pole Switch x2; WDHA-12R - Wireless Gateway Module; Trane Thermostat; Retired: WDTC-20 - Z-Wave Enabled Thermostat

Offline mikeholczer

  • Sr. Member
  • ****
  • Posts: 413
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #7 on: June 07, 2010, 10:04:57 pm »
Not sure, I'm skipping over UI3.

Offline Boyo

  • Full Member
  • ***
  • Posts: 180
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #8 on: July 21, 2010, 01:23:14 pm »
Any luck with gettin this up and running?
Vera UI4 1.1.1183; Schalge Link Door Handle; HA18WD 3-Way/Single-Pole Switch x2; WDHA-12R - Wireless Gateway Module; Trane Thermostat; Retired: WDTC-20 - Z-Wave Enabled Thermostat

Offline mikeholczer

  • Sr. Member
  • ****
  • Posts: 413
  • Karma: +0/-0
Re: Possible enhancement to WOL plugin
« Reply #9 on: July 21, 2010, 03:08:49 pm »
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.

Offline mcvflorin

  • Administrator
  • Hero Member
  • *****
  • Posts: 1755
  • Karma: +11/-3
Re: Possible enhancement to WOL plugin
« Reply #10 on: November 02, 2010, 09:49:33 am »
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.

Offline m0jon

  • Full Member
  • ***
  • Posts: 113
  • Karma: +0/-0
  • @m0jon
Re: Possible enhancement to WOL plugin
« Reply #11 on: November 08, 2010, 01:31:48 am »
Hi All.

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

Any help would be greatly received.

Cheers

m0jon