[userModule] MediaCenter (Kodi/xbmc on/off)

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
Post Reply
mhorst
Posts: 27
Joined: 30 Dec 2014 15:10

[userModule] MediaCenter (Kodi/xbmc on/off)

Post by mhorst »

This module creates an binary switch for Kodi (xbmc) media centers. It enables you to turn the media center on and off. It also detects whether the media centers are on or off (by pinging them every 10 minutes) and updates the state of the switch accordingly.

It requires that your media center have a fixed IP address, that they are configured for remote operation, and that they respond to wake-on-lan request. You will need to know the IP address and the MAC address of the media center.

Furthermore, when installing this module, add the following lines to /opt/z-way-server/automation/.syscommands:

Code: Select all

/usr/bin/wakeonlan
/opt/z-way-server/automation/userModules/MediaCenter/rpc_shutdown.sh
/opt/z-way-server/automation/userModules/MediaCenter/check_ip.sh
(Assuming your z-way installation is in /opt/z-way-server, otherwise modify the paths accordingly.)
Otherwise you will get errors saying that the command is denied by policy.

The system on which you run z-way has to have the wakeonlan, nc and ping utilities installed. Running:

Code: Select all

apt-get install wakeonlan netcat
should do the trick.

For debugging purposes you can run the rpc_shutdown.sh, wakeonlan and check_ip.sh manually:

Code: Select all

rpc_shutdown.sh <ip-address>
Will shut down the media center. If it does not, check that you are using the right ip-address and that your media system is configured for remote operation on port 9090

Code: Select all

wakeonlan <mac-address>
Will start the media center. If it does not, check that your are using the right mac-address and that your media system is configured to respond to wake-on-lan request

Code: Select all

check_ip.sh <ip-address>
Will check whether an ip-address responds to ping requests (i.e. whether it is up or not) with an exit code. Run it using:

Code: Select all

check_ip.sh <ip-address>;echo $?
If it returns 0 then the host is up, otherwise it is down.
Attachments
MediaCenter-0.1.0.zip
(2.95 KiB) Downloaded 461 times
Post Reply