Switching Hyperion on/off via keyboard/remote?!

  • Yes, that's working well with LE...


    Create a script witch toggle between on/off:


    nano /storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh


    #!/bin/sh

    SERVICE='hyperiond'

    if ps | grep -v grep | grep $SERVICE > /dev/null

    then

    systemctl stop service.hyperion

    else

    systemctl start service.hyperion

    fi




    Make the script executable:


    chmod +x /storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh




    Now modify the keyboard mapping for example the blue key:


    nano /storage/.kodi/userdata/keymaps/remote.xml


    system.exec("/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh")


    Optional you can always switch off Hyperion on boot up by autostart script:


    nano /storage/.config/autostart.sh

    (

    systemctl stop service.hyperion

    ) &

  • Thanks alot so far!


    this is as far as I get...

    created the sh file - worked.

    created the remote.xml - worked


    But when I now try to press the "Insert" Button on my Keyboard nothing happens. This is what my script looks like

    Code
    1. <keyboard>
    2. <key id="insert">system.exec("/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh")</key>
    3. </keyboard>

    Is that wrong? Sorry as I said I'm pretty much a noob... If I use insert or VK_INSERT does not make a difference... I also tried the codes from the kodi.log but still no change (in kodi wiki there is said something about a decimal number in the log file but there just was none. only hex and text just as "homepage" when I tried the homepage button)


    Thanks in advance!


    Edit: Seh grade ich glaube wir können auch DEUTSCH schreiben ;)

    Edited 5 times, last by KnoRke84 ().

  • Hm, wusste gar nicht dass es eine "insert" Taste gibt. Wenn du allerdings auch den Key-Code versucht hast, liegt das Problem vielleicht woanders. Probier mal, mit der "blue" Taste ob's damit geht oder nicht. Wenn ja, kontrollier noch einmal ob der Key-Code auch richtig ist.


    Debug wieder einschalten und dann:

    tail -f /storage/.kodi/temp/kodi.log

    Tasten drücken


    Einen Neustart von LE wirst du sicherlich schon versucht haben...

  • What is the blue key for? Is it the blue key on a remote? As I said i am using a keyboard and dont know where there should be a blue Key ;) Insert is the Insert Key from the keyboard.

    When i create the Script with blue Key i dont know what Key to press on the keyboard. But I will for sure Check the tail command out.

  • If you are using keyboard use keyboard.xml /storage/.kodi/userdata/keymaps/keyboard.xml and add under global

    Code
    1. <global>
    2. <keyboard>
    3. <insert>XBMC.RunScript(/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.py)</insert>
    4. </keyboard>
    5. </global>


    hyperion_switch.py:


    Code
    1. #!/usr/bin/python
    2. import sys
    3. import subprocess
    4. subprocess.call(["/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh"], shell=True)


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • vpeter

    Yes, you're right, he want to use a PC keyboard instead of a remote. That's my mistake when I read his post.

    Your code should solve his question

  • Hey guys,


    first of all thank you for all the responds you gave me.


    But I am still kinda stuck. I used vpeters scripts and assigned the insert key with it. I also bought a remote where I assigned different keys with the script. (Added the script for the remote in the remote.xml)


    None of this seems to work. When I use the Mac Terminal and trail the kodi.log to see which keypress is recognized it shows me the key but after "action" there is nothing displayed.


    If the script would be assigned correctly wouldnt there be a action assigned in the kodi.log?


    Thanks in advance!

  • Fragments I posted is used daily on my system. And they works. Check the paths if they are correct.


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)


  • Hello guys, sorry for not responding so long - I have been on vacation for 3 weeks.


    I uploaded images of all the files I used, the file system and the kodi log when I press the button. I hope someone can tell me what the heck I am doing wrong :(



    Note: the "doublequote" Button is the alternate binding on my remotes "@" key - I also used a variety of other keybindings but non of them seem to work.


    It also says in the Log that the button is pressed but there is no action afterwards.


    Regards

    KnoRke

  • Hey vpeter,


    Look at the 3rd image. I posted it on imgur as writen above.


    KHvfuWs.png


    Edited 2 times, last by KnoRke84 ().

  • Well, I read whole thread again and I don't see what you actually did. Post all extra files, keyboard.xml and everything changed to see what is wrong.


    Because action is empty it is obvious nothing is called. For example in my case I get

    Code
    1. 20:14:52 T:140047189047360 DEBUG: OnKey: ctrl-shift-f4 (0x3f093) pressed, action is XBMC.RunScript(/storage/downloads/bin/store_play_tv_channel.py, store)


    Support my work with small (or big) Paypal donation


    Amlogic devices works better with CoreELEC

    Blu-ray Disc Java menus support - forum thread, Github

    my lamp addon (unofficial/community with limited support)
    my touchscreen support and instructions by Grruhn (now touchscreen addon exists in repository)