NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Kodi / XBMC v
« Previous 1 … 16 17 18 19 20 … 43 Next »
anyone fluent in Kodi JSON RPC API?

 
  • 0 Vote(s) - 0 Average
anyone fluent in Kodi JSON RPC API?
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#1
2017-11-10, 01:00 AM
I know this is a bit outside the NextPVR realm, but I'm hoping some of you smart folks who are fluent in Kodi might be able to help me out.

I'm running Kodi 17.5 and found a neat little addon script which when triggered opens a small overly of a security camera and then closes it after a set period of time. The script works great, but it needs to be triggered from a JSON RPC API command to kodi from an external source. My security camera system has the capability of executing a command on motion detection and which works, but the only way I've found to trigger it is with a http command.

Code:
http://192.168.1.20:8081/jsonrpc?request={"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.securitycam"},"id":"1"}}

It works, but the drawback is it opens a browser session every time the VSR triggers it. So that led me down the path of looking for a cleaner solution which brought me to curl...

I've googled for hours and spent the better part of the last 2 evenings trying to get this to work to no avail. Here's the curl command I've come up with but it kicks an error. It's somewhere in the parameter string I think (note the id:null should be a 1). I've tried every conceivable combination of quotes, double quotes, no quotes, single quotes to no avail... for the life of me I can't figure it out.

Code:
C:\PROGRA~1\curl\bin\curl.exe -s -H "Content-type: application/json" -d '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.securitycam"},"id":1}}' http://192.168.1.20:8081/jsonrpc

Code:
{"error":{"code":-32700,"message":"Parse error."},"id":null,"jsonrpc":"2.0"}

I'm guessing it's something simple, but I'm to the point of admitting defeat. I'm way outside of my knowledge zone and I'm in desperate need of some help, anyone got any ideas? Just thinking out loud as I typing this, maybe I'm on the wrong track? I'm not married to curl, if ther's another way to reach the same goal I'm all ears!
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
jcole998
Offline

Posting Freak

New York, USA
Posts: 855
Threads: 186
Joined: Jun 2015
#2
2017-11-10, 02:26 PM
FWIW, but I believe that the final curly-brace is not paired and should be dropped. Also the 1 in "id":1 should be quoted: "id":"1".

Hope this helps.
Later...JohnC

System Status: Humming nicely!  Smile
Desktop: Intel DX38BT MB - Intel Q9650 3GHz Quad - NVIDIA GeForce GTX 1050 Ti Graphics
Software: Win 10 Pro(Build 1909) - NextPVR - WinTV8
Video: Verizon FiOS - Hauppauge DCR-3250 - Hauppauge 1512 HDPVR2
RaspberryPi 4 Raspbian and FLIRC
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#3
2017-11-12, 09:36 PM
Just to close the loop on this and maybe help someone else who stumbles onto this post, I finally got it working. It seems curl, at least the windows version, is really picky in the http formatting. Encoding the url is the secret which made everything work.

Code:
curl -g 192.168.1.20:8081/jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22Addons.ExecuteAddon%22%2C%22params%22%3A%7B%22addonid%22%3A%22script.securitycam%22%7D%2C%22id%22%3A1%7D
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
mvallevand
Offline

Posting Freak

Ontario Canada
Posts: 52,767
Threads: 954
Joined: May 2006
#4
2017-11-12, 10:48 PM
Are you sure it is curl? You might need to escape the quotes with a ^ in any command line.

Martin
snagglewest
Offline

Senior Member

VA USA
Posts: 361
Threads: 60
Joined: Jul 2011
#5
2017-11-13, 01:45 PM
You may be right Martin, but at least encoding the url worked. At this point I'm just happy to get it working!
NextPVR V6.1.5.231022 - Ubuntu 22.04 VM / 4 core / 8Gb memory
HDHR Prime X2 / HDFX-2 /Schedule Direct / 2X Pi4 + & 3X Pi3 LibreELEC Kodi clients
Server - TrueNAS/ SuperMicro MBD-X10SL7-F MB / Xeon E3-1246 / 32Gb Unbuffered ECC / 8 X 4TB RAIDZ2
« Next Oldest | Next Newest »

Users browsing this thread: 2 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Kodi Channel not updating aTF6i 2 352 2025-03-09, 12:26 AM
Last Post: aTF6i
  EPG not loading in Kodi? membball84 3 326 2025-02-13, 01:24 AM
Last Post: membball84
  Automated Updates of IPTV Channels in NPVR and Kodi via APIs taylormia 1 722 2025-02-04, 03:13 AM
Last Post: lustfulmacaw
  Kodi 22 (Piers) and library thumbnails mvallevand 8 1,084 2025-01-15, 06:32 PM
Last Post: mvallevand
  Suggestions for the KODI Add-on Escape7 38 8,732 2024-12-20, 05:31 AM
Last Post: sub
  Kodi Channel Icons wrong and can't be corrected wapkaplet 11 922 2024-10-23, 02:11 PM
Last Post: mvallevand
  Kodi PVR Client Not Working trongod 8 1,350 2024-09-11, 10:20 PM
Last Post: trongod
  Kodi 21.0 Omega/NextPVR 21.1.0 PVR & Live TV Group Manager bouilliabai 28 3,900 2024-08-06, 10:00 PM
Last Post: sub
  Kodi-V5 WiFi Problem? kerryball 0 358 2024-06-26, 06:49 AM
Last Post: kerryball
  Adding/editing timer to one time (manual) recording from Kodi guide has no effect mmortal03 6 1,028 2024-06-25, 09:30 PM
Last Post: mmortal03

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode