Hey, thank you very much for this post!
Perhaps somebody is helped with my solution for my headless raspberry pi3:

An udev rule which matches the MAC Address of the button, could be one for different buttons.
ATTRS{phys}==”b8:27:eb:a0:40:b7″, SYMLINK+=”wolpc”, ACTION==”add”, TAG+=”systemd”, ENV{SYSTEMD_WANTS}=”wolbuttonpc.service”

This rule triggers a systemd service which starts a python script


Description=WOL Button fuer PC


The python script, slightly modified from Jon Burgess, sends a wol packet at first run and then every time the button goes up (holding the button emits a lot of button downs for me)

#!/usr/bin/env python

import sys
import evdev
from wakeonlan import wol
import syslog

devices = [evdev.InputDevice(fn) for fn in evdev.list_devices()]

if len(devices) == 0:
print “No devices found, try running with sudo”

for device in devices:
if device.phys == “b8:27:eb:a0:40:b7”:
for event in device.read_loop():
#event at 1492803542.433958, code 115, type 01, val 00
if event.code == 115 and event.type == 01 and event.value == 00:
syslog.syslog(‘WOL gesendet’)