[Solved] Switching Hyperion on/off via remote

  • Hi there,

    i would like to toggle Hyperion on/off via remote on my RPI3 but can't figure out how.

    I'm using libreELEC 8.2.4 and the Hyperion addon from Team LibreELEC.

    Everything works fine.

    I found this post here Switching Hyperion on/off via keyboard/remote?!

    I understand that i need a script to switch and an remote.xml for the remote.

    Here is what i have done so far

    script witch toggle between on/off in /storage/.kodi/userdata

    an make it executable

    chmod +x /storage/.kodi/addon/service.hyperion/hyperion_switch.sh

    Bash
    #!/bin/sh
    if ps | grep -v grep | grep hyperiond > /dev/null
    then
    killall hyperiond
    else
    /bin/sh /storage/.kodi/addons/service.hyperion/bin/hyperiond.sh /storage/.kodi/userdata/addon_data/service.hyperion/hyperion.config.json 
    </dev/null >/dev/null 2>&1 &
    fi

    and the remote.xml in /storage/.kodi/userdata/keymaps

    Code
    <keymap>
      <global>
        <remote>
          <blue>system.exec("/storage/.kodi/userda<img src="https://forum.libreelec.tv/core/images/smilies/emojione/2639.png" alt=":(" class="smiley" srcset="https://forum.libreelec.tv/core/images/smilies/emojione/[email protected] 2x" id="wscSmiley_0_1" height="23">ta/hyperionswitch.sh")</blue>
        </remote>
      </global>
    </keymap>

    OK now to my problem:

    While playback i can toggle off hyperion pressing the blue button on my remote. =>fine :)

    But Hyperion restarts immediately => :( why?

    I'm pretty much a noob in these things und really need your help.

    i have done the test from vpeter

    Code
    ps
    python /storage/.kodi/userdata/hyperionswitch.sh
    ps
    python /storage/.kodi/userdata/hyperionswitch.sh
    ps

    result:

    Thanks in advance,

    Gordi

  • Try using systemctl in hyperion_switch.sh like

    Code
    if ps | grep -v grep | grep hyperiond > /dev/null; then
      systemctl stop service.hyperion.service
    else
      systemctl start service.hyperion.service
    fi