script for kodi shutdown and start

Moderator: leecollings

Post Reply
DaWauZ
Posts: 69
Joined: Wednesday 05 November 2014 10:14
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

script for kodi shutdown and start

Post by DaWauZ »

Hello,

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 #####

In the log its giving this error when shutting down mediaplayer (press off)

Code: Select all

2016-09-29 19:34:33.147 Error: Error executing script command (/home/pi/domoticz/scripts/domoticz_main). returned: 13312
I dont know exactly why.

(I'm sorry I am not a very good in linux)
Raspberry Pi 2 model B with domoticz
OMV NAS installed on thin client HP T610
Openelec Kodi Mediaplayer on thin client HP T520 (and with multiboot windows 10)
borgkitty
Posts: 34
Joined: Wednesday 26 October 2016 21:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.5877
Contact:

Re: script for kodi shutdown and start

Post by borgkitty »

did you make the script excutable by issuing the "chmod +X *scriptname*" command?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest