I have made a little script with a little help from user mcwieger
But I think the shutting down command is giving a little error in the log. Well, the kodi mediaplayer does shutdown.
The mediaplayer is a openelec installation on a thin client, enabled WOL on that device. Installed etherwake on my domoticz pi.
I made a virtual switch, and put this in my domoticz_main:
Code: Select all
#!/bin/sh
startup_path=$1
hardware_id=$2
device_id=$3
status=$4
status2=$5
devname=$6
echo "startup_path=${startup_path}, hardware_id=${hardware_id}, device_id=${device_id}, status=${status}, status2=${status2}, devname=${devname}"
##### START KODI COMMANDS #####
### Native Kodi does not shutdown correctly. Two switches were created to switch Kodi on and off
### Kodi - Power On
if [ "$device_id" = "13" ] ; then
if [ "$status" = "On" ] ; then
sudo etherwake C8:CB:B8:03:54:84
fi
fi
if [ "$device_id" = "13" ] ; then
if [ "$status" = "Off" ] ; then
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"jsonrpc":"2.0","method":"System.Shutdown"}' http://192.168.1.13:80/jsonrpc
fi
fi
#### END KODI COMMANDS #####
Code: Select all
2016-09-29 19:34:33.147 Error: Error executing script command (/home/pi/domoticz/scripts/domoticz_main). returned: 13312
(I'm sorry I am not a very good in linux)