from wakeonlan import wol
##---------------------------------------------------------------------------------------##
class WOL(object):
##-----------------------------------------------------------------------------------##
def __init__(self, devices):
count = 0
self.devices= {}
for device in devices:
self.devices[device] = devices[device]['mac']
def config(self):
config = {
"device" : {
"name" : "",
"mac" : ""
},
"wake" : {
"device" : "name",
"state" : "button"
}
return config
def command(self, data):
for device in data:
if device in self.devices:
self.wakeDevice(device)
def wakeDevice(self, device):
mac = self.devices[device]
wol.send_magic_packet(mac)