Addon Settings Notifications

  • I have a simple addon that I'm building that essentially installs a case fan installer that I made, through the settings page of the addon.

    At the moment I can do pretty much everything I need to but the whole thing is contingent on RunScript.

    Which works.

    But what I'm running into is there is no notification for when the button is selected.

    All I need is a "confirmation" popup, something that can notify me that the button press was received by kodi.

    (example: Autowidget menu, force refresh widgets has a quick pop up that shows the action was "started")

    How would I go about doing this?

    I've tried google searching terms with "notifications" dialog" but everything was beyond what I'm trying to accomplish.

    Or completely off topic..

    Does anyone know of a way to accomplish this?

  • Go to Best Answer
  • I've been reading this since you posted it, and trying to search up how to use it. But I just don't understand.

    Do I add that to a script? Python or shell?

    Or do I add that to the settings label?

    I don't understand how to use jsonrpc. Or what it is.

    These two files make up the entirety of my addon:

    Example of My settings.xml:

    Code
    <setting label="Turn On and Off" type="lsep"/>
    <setting label="Set Fan to 100%" type="action" action="RunScript(/storage/.kodi/addons/script.hellotestwindow/resources/scripts/TurnFan_On.py)"/>

    and the TurnFan_On.py

    Code
    import os
    os.system('echo "pwm_100" > /dev/ttyUSB0')

    I do have an installer button, that copies an installer(from within the addon) I made for a case fan(Deskpi Pro) to /storage/ and runs it.

    I tried putting that code in a test.py file and using the code I have above to run it. I also tried an sh file.

    But nothing happens.

    I also added it to the TurnFan_On.py file, and still nothing happens.

    I'm utterly lost.

    How do I use that?

    Do I pass it as a argument?

    I don't know where to put it to even test it.

    And even when I google kodi jsonrpc. The wiki says this:

    JSON-RPC is a HTTP- and/or raw TCP socket-based interface for communicating with Kodi. It replaces the deprecated HTTP API, and offers a more secure and robust mechanism in the same format. It is based upon the JSON-RPC 2.0 specification.

    I don't understand why I would need to connect via http/tcp to send a user notification that a button inside an addon settings was executed/pressed.

    I just don't understand. And I feel like an idiot for it lol

  • VPETER!!!! <3

    THAT WORKED,

    But when I went to the kodi wiki link you posted it said:

    Quote

    Since we require all used strings to be localized (translatable) we recommend the second option.

    So I decided to use:

    (although I doubt my addon would get implemented in the main repo, or get/need translating.)

    Although the icon isn't coming up. But I think I might be able to figure that out, not a biggie if not though.

    The "i" works perfectly.

    I also saw:

    Which is AWESOME.

    Plus changing .ok to .yesno seems to add some fun options.

    Although I suspect I would have to start implementing more substantial code to have that functionality, and I could barely do this atm.

    There's ALSO some json rpc examples at the bottom.

    THANK YOU!!!! THIS WAS EXACTLY WHAT I NEEDED.