Switch Configs with Script

  • Hi everyone! I'm relatively new to Hyperion, however now got a nice setup with APA102 LEDs going thanks to the info and help here in the forum :)


    I have searched the last 3 days for a solution to this problem with different search terms without success. Please excuse if this has been answered before, however I could't find it in the FAQ either:


    Switching Configurations
    - I have 3 hyperion.config.json files. 1 normal one, 1 for 21:9 and one for 3D content
    - They differ only in the USB grabber cropping values and the startup animation so that I can tell them apart
    - If I upload the config with the different cropping values from HyperCon, the configuration gets applied correctly with the respective cropping values
    - I put all 3 files in "/etc/hyperion"
    - I can switch them with a python script I found here:https://hyperion-project.org/t…-off-toggle-for-kodi.473/
    - I have given all necessary permissions for the script to execute correctly


    My script:

    Code
    import os
    # kill hyperiond and rename config files
    cmd = "sudo systemctl stop hyperion.service 2>/dev/null; sudo /etc/init.d/hyperion stop 2>/dev/null ; sudo /sbin/initctl stop hyperion 2>/dev/null"
    os.system(cmd)
    os.rename("/etc/hyperion/hyperion.config.json", "/etc/hyperion/hyperion.config3.json")
    os.rename("/etc/hyperion/hyperion.config1.json", "/etc/hyperion/hyperion.config.json")
    os.rename("/etc/hyperion/hyperion.config2.json", "/etc/hyperion/hyperion.config1.json")
    os.rename("/etc/hyperion/hyperion.config3.json", "/etc/hyperion/hyperion.config2.json")
    cmd = "sudo systemctl start hyperion.service 2>/dev/null ; sudo /etc/init.d/hyperion start 2>/dev/null ; sudo /sbin/initctl start hyperion 2>/dev/null"
    os.system(cmd)


    I can invoke the script from command line (sudo python /usr/share/hyperion/effects/Config-Default.py). Hyperion stops, restarts, plays the different startup animation and everything is good to go again.


    The problem is that the whole point of switching the configs, having different image cropping from the grabber, doesn't get carried over.


    What am I missing for the cropping values to stick?


    Second question:
    I added my "Config-Default.json" file in the effects folder so that I can invoke the script from the hyperion remote android app.


    It only has these 4 lines in it:


    Code
    {
        "name" : "Config Switch",
        "script" : "Config-Default.py"
    }


    I can see the effect show up in the remote. However when I execute it, the lights just go out and the service gets stopped, but not restarted. No startup animation is played. Log file:



    Why doesn't the service get restarted when the python script gets called by the remote app?


    Thanks everyone in advance for your input!


    Robin

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!