The Kodi built in functions appear to be broken in LE, I never could get to the bottom of it.
I use the following script for my TV. It creates two temporary files to track status. $file indicates whether the TV is on or off, $file2 indicates that the script is working as there is a several second delay for cec-client to do it's thing. $file2 prevents my impatient wife from pressing the button a million times and running the script over and over.
The script also sends a stop command to kodi and sends a notification when turning off the tv. I simply leave my LE box on all the time.
#!/bin/bash
file="/storage/.kodi/userdata/tvon"
file2="/storage/.kodi/userdata/tvworking"
if [ -e "$file2" ]
then
exit
else
if [ -e "$file" ]
then
echo 1 > "$file2"
kodi-send --action="Notification(Shutdown,Turning TV off now,6000)"
kodi-send --action="PlayerControl(Stop)"
echo "standby 0" | cec-client -s
rm "$file"
rm "$file2"
else
echo 1 > "$file2"
echo "on 0" | cec-client -s
echo 1 > "$file"
rm "$file2"
fi
fi
Display More
The script is called cecpower.sh and I call it from my keymap like this:
<key id="323664">system.exec(/storage/.kodi/userdata/cecpower.sh)</key>
The whole thing is quite a hack, but it works in my case.