Wake on lan

From Official Kodi Wiki
Jump to navigation Jump to search

Starting in v13, Kodi can automatically issue a 'wake-on-lan' packet to MySQL or a file sharing server right before it needs to connect to it.

Basic setup

Enable wake-on-lan under Settings → System → Power saving → Try to wake remote servers on access

When feature gets enabled or shares gets added an autoscan will be done for any servers specified, either in shares or in MySQL settings. The autoscan will if necessary create a file called 'wakeonlan.xml' and will add entries for these servers including macaddress which should be picked up in the scan.

Advanced settings

While not required for basic operation, some additional settings can be made to the wakeonlan.xml file that is stored in the userdata folder.

Sample 'wakeonlan.xml'

<onaccesswakeup>
   <netinittimeout>60</netinittimeout>
   <netsettletime>500</netsettletime>
   <wakeup>
       <host>10.0.0.6</host>
       <mac>11:11:F2:11:DF:1E</mac>
       <pingport>0</pingport>
       <pingmode>1</pingmode>
       <timeout>600</timeout>
       <waitonline>38</waitonline>
       <waitonline2>40</waitonline2>
       <waitservices>0</waitservices>
   </wakeup>
</onaccesswakeup>


Parameter Description
netinittimeout [secs] time Kodi will wait for network to (re)connect when booting or after resuming from suspend-mode
netsettletime [milli secs] time to wait for network to be consistently connected before progressing
host ipaddress (or network name) of machine you want to wake up
mac macaddress
pingport default 0 which will perform ordinary icmp ping. else a 'connect' attempt will be done to the specified port
pingmode only applicable if pingport!=0, if 1 will not only connect to pingport but also wait until data is actually read back
timeout [secs] specifies how long time (default 600) of inactivity must pass before a new 'wake-on-lan' check is performed. a good choice is to use same value as server's idle-timeout before entering sleep-mode
waitonline [secs] time to wait for machine to wake up (advise is to set this to servers actual anticipated startup time)
waitonline2 [secs] time to perform extended wait for machine to wake up
waitservices [secs] additional time to wait after ping response, to allow server daemons to startup

Useful pingport/pingmode combinations

  • pingport = 445 / pingmode = 0 - port 445 is used by samba (windows file sharing) and can be used for 'ping-probing' (but only pingmode = 0)
  • pingport = 3306 / pingmode = 1 - port 3306 is default MySQL port and useful if your server is the MySQL host

port 21 (ftp), 22 (ssl), 23 (telnet) are also likely to work OK if your server has that service installed


When using pingport = 0 (normal icmp ping) it is recommended to use waitservices = (ca) 5 to allow services on server to startup after server responds to ping. If using a different pingport it is normally not nessesary to add additional wait time.

Limitations / Pitfalls

  • Wake on Lan does not wake PVR-servers (Forum request)
  • Wake on Lan does not wake UPnP-servers, including other Kodi- installations (Pending PR)
  • Wake on Lan can come 'out of sync' if you force-sleep the server (if server stays on shorter time than specified in parameter 'timeout' before it suspends)
  • Wake on Lan can fail to bring up the progress-dialogue depending on where playback was initiated from. It will still wake the server and start playback, but visual feedback is poor. (Pending PR)

Changelog / Improvements

  • Wake on Lan could fail to wake servers specified by name (not ip-address) but this is solved in Kodi v14/Helix (Github PR)
  • Wake on Lan did not support profiles but this is solved in Kodi v14/Helix (Github PR)
  • Wake on Lan could fail to execute during startup when Kodi starts and contacts server really fast, typically with SSD disk and use of MySQL server. Solved in Kodi v16/Jarvis (Github PR)