Help get this topic noticed by sharing it on Twitter, Facebook, or email.

Kodi 18 Leia and new JSON delivery?

Anyone had the time an energy to modify iRule commands/delivery for Kodi 18 Leia and the new JSON delivery? About to give it a go but hoping someone else has already done some of the work. Many thanks!
2 people have
this question
+1
Reply
  • Short version:
    For security reasons there is a significant change in v18 that prevents GET working for most of the API commands so we have to use POST instead going forward.
    Have not been able to get anything working as yet. Suspect the strings might need some changes too. Anyone had a look?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • YES.

    The key to getting it to work in iRule are the following details:

    1. Gateway configured as a NETWORK gateway (contrary to logic) with your Web Socket port as the port number (default: 9090)

    2. Create a Device handler in iRule Builder

    3. Add a new Device Code to the Kodi device

    4. Enter your URL in this format (for the new device code):

    jsonrpc?request={"jsonrpc":"2.0","method":"Input.Up", "id":1}

    If you have any existing HTTP gateways for Kodi, you may need to remove them to get it all to work properly

    Cross-posted on Kodi forum.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Thanks HTGeek!

    Tried this without success so far.
    Not sure I get what you are suggesting and might be missing something obvious?
    Will this require an intermediate web socket device of some kind?
    Have a sec to elaborate? Do you mean we can simply keep the existing URL:s?
    And add the device to a network gateway instead?
    Any settings needed on Kodi Leia instance?
    Your URL example is what I use in current version and is the current standard.
    Many thanks regardless!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • It took a lot of tinkering on my end to figure it out, so I understand your frustration!

    -------------------------------------

    Configure Kodi

    First, ensure Kodi has been manually enabled to allow remote access.

    There are two ways to verify this.

    Option A: via Web browser on another computer

    1. Open a web browser and point it to your HTTP port on your Kodi machine. For example:

    http://192.168.1.1:8080

    2. On the left nav pane, click on the Settings icon (gear shape).

    3. Scroll down in the main nav pane until you find the setting called, "Allow remote control from applications on this system." Turn it on. Scroll all the way down the frame and MAKE SURE YOU CLICK THE SAVE BUTTON!!

    4. Now, look again on the left nav pane. Click on System. Scroll down about 1/2 way until you get to the section called, "Internet access." Verify the Username and Password fields match your expectations. If you want to use one, enter them here. If you make any changes, don't forget to scroll all the way down and CLICK THE SAVE BUTTON!

    5. Looking at the left nav pane again, under General, click "Web interface." Scroll down to Advanced Options. Note the Websockets Port. If you changed it, make sure you scroll down and SAVE any changes. This should just be a verification step though. You will need the Web Socket port number in a moment.

    6. You're now finished with Kodi setup. Restart Kodi.

    ------------------------------------------------------

    Option B: Online guide.

    There is no official guide for this that I have been able to find. One of the best tutorials is on the website for the Yatse plugin for Kodi. The URL to the tutorial for Leia is here: https://yatse.tv/wiki/configure-kodi-...

    If you did not follow the steps for Option A, above, then follow the guide linked above.

    ----------------------------------------------------------

    Configure iRule

    In iRule, you need a Device in iRule Builder. It sounds like you already have that, but to be clear... I named mine "Kodi". I created new Device Codes under Network Codes. That should be same as what you already have. Your device codes from v17 or v16 will work for the most part.

    1. Create a new Gateway, type Network. Set the Port to Kodi's Web Socket port number (default 9090 or whatever you set it to). For the URL to Kodi, set it as the IP address only. Don't type anything after that.

    e.g. 192.168.1.1

    2. If you setup a username and password in Kodi, you will need to enter them here. Otherwise, leave Username and Password fields empty.

    3. Select TCP.

    4. Now, go to Devices on your mobile device. It should save your Gateway config when you leave that screen. Locate your Kodi device in iRule on your mobile device.. Tap Configure. Add it to the new Kodi network gateway.

    Restart iRule on your mobile device.

    --------------------------------------------------

    You *should* now be GTG.

    If it does NOT start working now, let me know.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Many thanks for your extensive help!
    Have tried to make this work but have been unable so far.
    The two things that are new to me in this:

    1. Using the webGUI to set these parameters.
    Why is this different to the same settings in the app GUI if I may ask?

    2. Internet access settings? Should i select a proxy here?
    iRule gives a green connected icon at bottom of GUI, but no response in the actual Kodi window. Will keep testing this..
    Many thanks again!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • 1. "Using the webGUI"... do you mean Kodi's Web interface?

    2. If you are getting the green icon, that's good. Might be how your JSON is formatted.

    I'll walk you through the Kodi Web GUI setup.

    Re: Kodi Web GUI: It looks like I gave a bit of poor description above with regards to how to find the correct menu items, so allow me to go over that anew. Or possibly it has changed a bit. Kodi just upgraded to v18.2.

    Something you can check... great new feature.... open the Kodi Web interface. On the far left side navigation pane, click the ? icon (Help). There is now a highlighted button you can click and the system will verify you are setup properly for remote control access.



    You can try that if you like.

    Now, to improve my instructions a bit on where the settings are you need to adjust in Kodi's web interface:

    1. On the far left side nav menu, click the gear icon (Settings).

    2. To the right of that nav pane, there's another one. Click on Services in that next navigation pane.

    3. You should now see on the right side nav pane a section beginning with "General." Scroll down. At the bottom of the "Control" section is a setting called, "Allow remote control from applications on this system"

    Make sure that switch is turned ON.

    Just above that - also under the "Control" section you'll see "Port" and "Username" and "Password". Ignore the "Port". That is for this Web interface you're using right now only.

    The Username and Password are important. Whatever you have here, you need to put that info in your iRule Gateway settings. For example, my Kodi install has username "kodi" and no password. So, in my iRule Gateway config for the Kodi network gateway, I have username "kodi" and a blank password field.

    If you changed anything on this Kodi screen, make sure you scroll all the way down in the right side nav and click the SAVE button.



    4. You asked about Proxy Server setting.

    Still in Kodi's Web GUI.... in the center nav pane, click "System"

    Scroll down in the right nav pane until you find the "Internet access" section.

    Normally, you want "Use Proxy Server" turned OFF. If you require a proxy server to access outgoing Internet connections, you should know what those are and that is the only time you need to turn this on and mess with it. Most common example is when you are on a work/office network.

    If you changed anything, scroll to the bottom of the right nav pane and click SAVE.

    5. Back to the center nav pane. Under "General," click "Web interface"

    6. You should now see on the right side nav pane a section beginning with "General options." Scroll down to the "Advanced options" section. Take note of the setting for "Websockets port."

    That is the port number you must use in the iRule gateway.

    Verify the "Websockets host" is the same IP address as your Kodi system.

    Normally, you would leave the "Reverse proxy support" setting OFF.

    If you changed anything here, scroll down and click SAVE.

    If that is all good, and you have restarted Kodi and restarted iRule, then it *should* work. If it's not... and you have the green connection icon in iRule... then it sounds like the problem is with either how your iRule device codes are structured OR the JSON command you're sending.

    Post a reply here if the steps above don't help and it still doesn't work, and we'll troubleshoot the other 2 possibilities (device codes, JSON syntax). :)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Thanks again HTGeek!

    Managed to get it working.
    The trick in my setup that was unknown to me was to follow your instructions
    for a new network gateway and to restart iRule on the iphone for the port to "take".
    I also needed to remove the encoding on my strings in iRule.
    That did it for me. A great side effect is that this appears to work on both Kodi 17 and 18 AFAIK. Many thanks again!
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Awesome!

    So glad you were able to get it working. I spent hours figuring it out. Seems ridiculous for a relatively simple solution, but getting the combo of all the parts set exactly a particular way seems to be the key.

    Thanks for letting me know it works with v17 as well. I had not tested that yet. :)

    And yes, the JSON encoding on the iRule device codes is picky as well.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Thanks again HTGeek.
    Really appreciate it!
    Any commands you are missing and need that I can share or something to show my gratitude?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • You're most welcome. Glad the info helped someone else.

    Wow, that's very generous of you to offer! I really can't think of anything I need at this time. I have yet to setup all my Kodi commands, but I'm not going to be using very many of them for the time being. Very much appreciate the offer though. :)
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • All ready tried all your procedures but still no luck
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • It seems that the only port its 9090 that did it for me
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned

  • Sounds like you got it working then.

    It is a rather finicky process, which is why it took me quite a bit of experimentation to figure it out. It *seems* simple, and technically it is, but there are so many nuances to Kodi and iRule that getting the combination working can be frustrating to say the least.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated happy, confident, thankful, excited kidding, amused, unsure, silly indifferent, undecided, unconcerned