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
    <keyboard>
      <key id="insert">system.exec("/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh")</key>
    </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 (September 15, 2017 at 4:46 PM).

  • 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
      <global>
        <keyboard>
          <insert>XBMC.RunScript(/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.py)</insert>
        </keyboard>
      </global>

    hyperion_switch.py:

    Python
    #!/usr/bin/python
    import sys
    import subprocess
    subprocess.call(["/storage/.kodi/userdata/addon_data/service.hyperion/hyperion_switch.sh"], shell=True)
  • 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!

  • 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 :(

    https://imgur.com/a/7Im4R

    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

    Display Spoiler

    ##############################################

    # LibreELEC #

    # LibreELEC – Just enough OS for KODI #

    ##############################################

    LibreELEC (official) Version: 8.0.2

    KodiPI:~ # tail -f /storage/.kodi/temp/kodi.log

    20:08:54.821 T:1961796720 INFO: CheckIdle - Closing session to LibreELEC – Just enough OS for KODI (easy=0x73b02d98, multi=0x73b38798)

    20:08:55.337 T:1961796720 INFO: CheckIdle - Closing session to feeds.kodi.tv (easy=0x73b13e88, multi=0x5d076a70)

    20:08:55.703 T:1873802144 DEBUG: Thread JobWorker 1873802144 terminating (autodelete)

    20:08:55.727 T:1722287008 DEBUG: Thread JobWorker 1722287008 terminating (autodelete)

    20:08:57.871 T:1542460320 DEBUG: Thread JobWorker 1542460320 terminating (autodelete)

    20:08:57.885 T:1671955360 DEBUG: Thread JobWorker 1671955360 terminating (autodelete)

    20:09:42.944 T:1929376672 DEBUG: CAESinkPi:Drain delay:100ms now:0ms

    20:09:52.945 T:1929376672 DEBUG: CAESinkPi:Deinitialize

    20:09:52.945 T:1929376672 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 00000000

    20:09:52.954 T:1929376672 DEBUG: COMXCoreComponent::Deinitialize : OMX.broadcom.audio_render handle 0x72601a48

    20:10:02.271 T:1961796720 NOTICE: Samba is idle. Closing the remaining connections

    20:10:27.704 T:1961796720 DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0

    20:10:27.704 T:1961796720 DEBUG: OnKey: down (0xf081) pressed, action is Down

    20:10:27.705 T:1929376672 INFO: CActiveAESink::OpenSink - initialize sink

    20:10:27.705 T:1929376672 DEBUG: CActiveAESink::OpenSink - trying to open device PI:HDMI

    20:10:27.705 T:1929376672 DEBUG: CAESinkPi:Initialize Format:15 Channels:6 Samplerate:44100 framesize:24 bufsize:52920 bytes/s=1058400.00 dest=PI:HDMI

    20:10:27.706 T:1929376672 DEBUG: CAESinkPi:SetAudioProps hdmi_stream_channels 0 hdmi_channel_map 0b02c4c8

    20:10:27.707 T:1929376672 DEBUG: COMXCoreComponent::Initialize OMX.broadcom.audio_render input port 100 output port 100 m_handle 0x7262bf08

    20:10:27.711 T:1929376672 DEBUG: COMXCoreComponent::AllocInputBuffers component(OMX.broadcom.audio_render) - port(100), nBufferCountMin(1), nBufferCountActual(2), nBufferSize(52928), nBufferAlignmen(16)

    20:10:27.712 T:1929376672 DEBUG: CActiveAESink::OpenSink - SinkPi Initialized:

    20:10:27.712 T:1929376672 DEBUG: Output Device : HDMI

    20:10:27.712 T:1929376672 DEBUG: Sample Rate : 44100

    20:10:27.712 T:1929376672 DEBUG: Sample Format : AE_FMT_FLOAT

    20:10:27.712 T:1929376672 DEBUG: Channel Count : 6

    20:10:27.712 T:1929376672 DEBUG: Channel Layout: FL,FR,FC,LFE,SL,SR

    20:10:27.712 T:1929376672 DEBUG: Frames : 2205

    20:10:27.712 T:1929376672 DEBUG: Frame Size : 24

    20:10:27.821 T:1961796720 DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0

    20:10:27.921 T:1961796720 DEBUG: Previous line repeats 1 times.

    20:10:27.921 T:1961796720 DEBUG: OnKey: down (0xf081) pressed, action is Down

    20:10:28.037 T:1961796720 DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0

    20:10:28.104 T:1961796720 DEBUG: Previous line repeats 1 times.

    20:10:28.104 T:1961796720 DEBUG: OnKey: down (0xf081) pressed, action is Down

    20:10:28.187 T:1961796720 DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0

    20:10:28.271 T:1961796720 DEBUG: Previous line repeats 1 times.

    20:10:28.271 T:1961796720 DEBUG: OnKey: down (0xf081) pressed, action is Down

    20:10:28.371 T:1961796720 DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0

    20:10:28.471 T:1961796720 DEBUG: Previous line repeats 1 times.

    20:10:28.471 T:1961796720 DEBUG: OnKey: down (0xf081) pressed, action is Down

    20:10:28.521 T:1961796720 DEBUG: Keyboard: scancode: 0x6c, sym: 0x0112, unicode: 0x0000, modifier: 0x0

    20:10:28.987 T:1961796720 DEBUG: Keyboard: scancode: 0x2a, sym: 0x0130, unicode: 0x0000, modifier: 0x1

    20:10:28.988 T:1961796720 DEBUG: OnKey: leftshift (0xf0d2) pressed, action is

    20:10:28.988 T:1961796720 DEBUG: Keyboard: scancode: 0x03, sym: 0x0022, unicode: 0x0022, modifier: 0x1

    20:10:28.988 T:1961796720 DEBUG: OnKey: doublequote (0xf022) pressed, action is

    20:10:29.121 T:1961796720 DEBUG: Keyboard: scancode: 0x2a, sym: 0x0130, unicode: 0x0000, modifier: 0x0

    20:10:29.121 T:1961796720 DEBUG: Keyboard: scancode: 0x03, sym: 0x0032, unicode: 0x0032, modifier: 0x0

    20:10:29.204 T:1961796720 DEBUG: Keyboard: scancode: 0x2a, sym: 0x0130, unicode: 0x0000, modifier: 0x1

    Edited 2 times, last by KnoRke84 (October 17, 2017 at 7:13 PM).

  • 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
    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)