Thanks vpeter for helping out. at least I am learning some basic bash conditions.
Portisch> well, in general, I am quite missing standby feature on Homatics/Dune box in CE (I know it can be achieved by remounting usb FS to internal storage, but I am bit hesitant to do this).
I got used to it in osmc that I had on my previous box. you are right, I really don’t know if stopping Kodi helps or not, but since I made this solution working now, I can check cpu temperature after couple hours of kodi being stopped. if I turn TV and check temperature while kodi is up, but “idle”, it is slightly above 50C, so wondering if that helps. It may help on some older devices…
For those who would be interested on how to achive kodi stop/start using BT remote (not IrDA), first use this script:
#!/bin/sh
up=$(ps -ef | grep -v grep | grep kodi.bin | wc -l)
device='/dev/input/event10'
match='*type 4 (EV_MSC), code 4 (MSC_SCAN), value c0030'
if [ $up == "1" ]; then
systemctl stop kodi
else
evtest "$device" | while read line; do
case $line in
($match) systemctl start kodi;;
esac
done
fi
you need to map it to specific key. I used power on/off button on B25 remote. this button is already assigned in Kodi, so I remapped it via homatics.hwdb:
KEYBOARD_KEY_c0030=f7 #standby
You need to save changes to the database:
#udevadm hwdb --update
#udevadm trigger -s input
#reboot
Then assign this function to your gen.xml. Snippet of mine looks like this:
<keymap>
<global>
<keyboard>
<key id="61526">contextmenu</key>
<key id="c0030">System.Exec(/storage/.config/standby.sh)</key>
<f5>activatewindow(10000)</f5>
<f6>System.Exec(/storage/.config/mutehdmi.sh)</f6>
<one mod="longpress">Skin.ToggleDebug</one>
</keyboard>
</global>
Then add the script from beginning of this post into autostart.sh
sleep 5
nohup /storage/.config/standby.sh &
Reboot box and it should work.