Http API for Control4
#1
So i see the Crestron home automation guys are experiencing the same issues as the Us control4 home automation guys No

So we use the http API which works on build 9.11 but not on any of the nightly builds. The only command that works is "Menu" nothing else. So some questions for the Xbmc team:

1. From which build did the http API change (I.e. As it use to be on 9.11)
2. Is there any documentation that helps us Dev understand the commands that have changed so we can adapt our http API drivers to accommodate the new json or whatever is being used in the background so that we can renewable the home automation systems to integrate into xbmc?

The old http API was simple Implement and worked really well. We hoping we can get the control4 users\customers to choose xbmc once again as the preferred media center!

Thank you
Reply
#2
Maybe this thread containing lots of information (yeah it's spread across a hell lot of pages) about the new JSON-RPC will give you some answers: http://forum.xbmc.org/showthread.php?tid=68263
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#3
Montellese Wrote:Maybe this thread containing lots of information (yeah it's spread across a hell lot of pages) about the new JSON-RPC will give you some answers: http://forum.xbmc.org/showthread.php?tid=68263

Thank you for your quick response Smile

I have been reading that threadSmile Sounds interesting Smile I can't figure out from that thread though when or which build did the stop the old http support? The reason I am trying to find out is I want to know what last build I can use for now until some new driver is built .... The json driver for the home automation systems is going to take a while to build..... Shocked
Reply
#4
automateXBMC Wrote:Thank you for your quick response Smile

I have been reading that threadSmile Sounds interesting Smile I can't figure out from that thread though when or which build did the stop the old http support? The reason I am trying to find out is I want to know what last build I can use for now until some new driver is built .... The json driver for the home automation systems is going to take a while to build..... Shocked

Your welcome. I did a quick search in the commit log for the merge of the jsonrpc branch into XBMCs trunk and found this changeset: http://trac.xbmc.org/changeset/27770

So my guess is that all builds up to 27769 should still contain the HTTP API as it is removed in r27770.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#5
Montellese Wrote:Your welcome. I did a quick search in the commit log for the merge of the jsonrpc branch into XBMCs trunk and found this changeset: http://trac.xbmc.org/changeset/27770

So my guess is that all builds up to 27769 should still contain the HTTP API as it is removed in r27770.

Again thank you first time i got a direct answer !!!!!

Do you know if there is any .net libs for this, the only thing I can think of now is creating some middle man that takes the http API calls from the home automation system and convert them somehow to json calls ?

Thue other question more directed at you is maybe we can send the http API calls you your web interface if your web interface is json ready?
Reply
#6
automateXBMC Wrote:Do you know if there is any .net libs for this, the only thing I can think of now is creating some middle man that takes the http API calls from the home automation system and convert them somehow to json calls ?

The only .NET Library for JSON-RPC I know of is called Jayrock and is open-source so grab a copy and check it out. If I remember right one of the guys posting regularly in the JSON-RPC thread (the one I posted first) is using Jayrock as well. Maybe you can drop him a line and he can provide you with what he got (maybe some kind of wrapper library if you're lucky).

EDIT: I just checked and it is Tolriq using Jayrock for YATSE.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#7
httpapi is still there, it is not removed yet.

Please post a log and a testcase were it fails.
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#8
topfs2 Wrote:httpapi is still there, it is not removed yet.

Please post a log and a testcase were it fails.

Thank you so much for listening and for the help. Ok to the point:

User case:
Home Automation system Control4 has a album art media interface to certain media centers. XBMC being the one that prob a good 80% of users use. There was a two way HTTP API driver released by a member of Control4 (the driver is written in LUA). I have the driver and code for the driver (if you want to interrogate the driver to help trouble shoot this).

Basically what the driver does is it sends the Play, Pause, Stop commands using the following HTTP API commands http://pastebin.com/ChFw4Dtb

Extract of commands for the purpose of this post

Quote:Play = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Play)",
Info = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Info)",
Pause = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Pause)",
Stop = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Stop)",
Skip_Next = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(SkipNext)",
Skip_Previous = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(SkipPrevious)",

So looking above basically what they do in the driver is declare a parameter for example
Quote: "Play"
and assign a HTTP API command to it I.e.

Quote:"GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Play)",

In the case of media files that are located on SMB shares on the network and not in the XBMC library they have the following function:

Quote:if (strCommand == "PLAY_THIS_FILE") then
playURL("smb:" .. tParams["FILE"])
end

In my use case this is what is not working on the current builds along with any of the commands i.e. Play, Stop, Pause.

The only command that works (for some odd reason) is MENU ..... but MENU is declared and send via the same method to the XBMC HTTP API as the other commands i.e.

Quote:Context_Menu = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(ContextMenu)",

Or

Previous_Menu = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Previous_Menu)",

Or

Show_Video_Menu = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(ShowVideoMenu)",

I have a full log of the system here - link on pastebin - I don't specifically see anything HTTP API related there so if there are any further debugs or parameters I need to enable to get a more verbose log for you please let me know I will do so immediately.

The log contains the following (from a use case):
I deleted the XBMC.log file (So we would have a clean log).
1. Started XBMC - wait 10 seconds to make sure everything is up and running nicely
2. From the interface (that makes use of the driver (that sends the commands specified above). Tried the following commands:
2.1 Play Movie at network location: \\crone\Movies - Complete\_BLU RAY 1080P\Madagascar 2 Escape To Africa.2008.BDRip.1080P\Madagascar 2 Escape To Africa.2008.BDRip.1080P.mkv - Movie did not start at all
2.2 Started this same movie from the same location on the SMB share then used the interface to try Play, Pause, STOP - with no luck

I want to note that on builds 9.11 (Stable build) and roughly to nightly builds 28xx *where xx = any version in that trunk* this works, I can use step 2.1 to play the movie and it starts and I have full control of the movie from the Control4 interface to, so either the HTTP API commands changed or something is different here.


Again I just want to thank you for taking the time to look at this and helping this Control4 community out here!!!! It would be much much appreciated.
Reply
#9
Afaict from your log it gets httpapi commands and should respond to them.

If you search for HttpApi in the log you should see a lot of calls.

line 726 - 18:34:01 T:3840 M:1073741823 DEBUG: HttpApi Start command: ExecBuiltIn paras: ExecBuiltIn; XBMC.Action(ParentDir)

As one example. Although I'm far from very knowledgable with httpapi I think that action command only take raw codes, i.e. XBMC.Action(9) in parentdir case but since your doing exec builtin that might be true
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#10
topfs2 Wrote:Afaict from your log it gets httpapi commands and should respond to them.

If you search for HttpApi in the log you should see a lot of calls.

line 726 - 18:34:01 T:3840 M:1073741823 DEBUG: HttpApi Start command: ExecBuiltIn paras: ExecBuiltIn; XBMC.Action(ParentDir)

As one example. Although I'm far from very knowledgable with httpapi I think that action command only take raw codes, i.e. XBMC.Action(9) in parentdir case but since your doing exec builtin that might be true

Should I try replacing the Exec with just plain xbmc.action(Raw_Code)?
Does the Action command still accept a SMB path to a movie file?

Again thank you Smile I really do appreciate this!!!
Reply
#11
Just so I am on the right track Smile

So would
Quote:Pause = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(Pause)",

Change to something like

Quote:Pause = "GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn&parameter=XBMC.Action(12)",

RAW codes at: http://trac.xbmc.org/browser/branches/li...?rev=16176 state that 12 is the raw code for PAUSE

OR would I have to change the whole ExecBuiltIn execute string to:

Quote:Pause = "GET /xbmcCmds/xbmcHttp?command=XBMC.Action(12)",

If that makes sense?
Reply
#12
To get more information about HTTP API you should also take a look at the Wiki article explaining it in detail: http://wiki.xbmc.org/index.php?title=HTTP_API

Why do you use Action anyway? There should be special commands for most actions available like "Pause" which would result in
Code:
GET /xbmcCmds/xbmcHttp?command=Pause()
There is a warning in the Manual about the "Action" command:
Quote:Sends a raw Action ID (see [1]) to xbmc. Be careful with this one since it runs the action on the webserver thread and depending on the action could lock the GUI thread.
And yes it seems that you need to provide an ID (number) instead of a string or whatever.

If you use the "Action" command with ExecBuiltIn it has a completely different effect. It executes the key mapped to the provided ID in the keymap in the currently active Window so this is not globally usable anyway.
Quote:Executes an action for the active window (same as in keymap)
from http://wiki.xbmc.org/index.php?title=Lis..._Functions
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#13
In my case i use this kind of calls :

"GET /xbmcCmds/xbmcHttp?command=PlayFile(smb://azeazeazeaze)"

or

"GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn(PlayerControl(Play))"

Perhaps the main problem is that you use the old &parameter way and parameters containing () not encoded.
Reply
#14
topfs2 Wrote:Afaict from your log it gets httpapi commands and should respond to them.

If you search for HttpApi in the log you should see a lot of calls.

line 726 - 18:34:01 T:3840 M:1073741823 DEBUG: HttpApi Start command: ExecBuiltIn paras: ExecBuiltIn; XBMC.Action(ParentDir)

As one example. Although I'm far from very knowledgable with httpapi I think that action command only take raw codes, i.e. XBMC.Action(9) in parentdir case but since your doing exec builtin that might be true

Hey there topfs2,

Just a quick question, so as you saw on http://pastebin.com/KQ0uKiG1 that build was showing some HTTPAPI commands, I recently reinstalled the build (as I was testing on a 2019 build because my driver was working on that), and it's not logging any more HTTPAPI calls from the driver.

So use case:

Install SVN:31642, compiler 1500, use my driver to do some calls i.e.:

Quote:GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn(PlayerControl(Play))

From the driver - no HTTPAPI entry in the XBMC log.

Open Firefox:

Quote:http://My_Server/xbmcCmds/xbmcHttp?comma...ntrol(Play))

HTTPAPI call is logged in the XBMC log.....

Downgrade to a 2016 build same use case:

Send HTTP commands via my driver, XBMC responds look in the log (*Note I always rename the XBMC.log file when I do a reinstall so I have a fresh log for that install), all the HTTPAPI calls from my driver are now logged in the Log (using the 2019 build). Do a web call from firefox:

Quote:http://My_Server/xbmcCmds/xbmcHttp?comma...ntrol(Play))

Same thing I get a XBMC log entry in the XBMC log.

As soon as I upgrade to the latest builds (or any build higher than 2xxx) I get a log entry for the HTTPAPI if I use a web browser (with the same HTTP commands):

Quote:
http://My_Server/xbmcCmds/xbmcHttp?comma...ntrol(Play))


But I get NO HTTPAPI entries in the log if my driver (application) does the calls.

As soon as I downgrade to a 2xxx Build I get HTTPAPI entries in the XBMC log for both a web browser call

Quote:
http://My_Server/xbmcCmds/xbmcHttp?comma...ntrol(Play))

and my applications call:

Quote:GET /xbmcCmds/xbmcHttp?command=ExecBuiltIn(PlayerControl(Play))

Why would 2xxx builds log my driver (app) calls, and builds higher than 2xxx only log calls from a web browser and not my driver (app)?

To me this does not point to a network / firewall or even driver (app) error as the common thing changing here is XBMC versions i.e. 2xxx and then upgrade to 3xxx.

Any help, advice or direction would be greatly appreciated!
Reply
#15
If firefox works then the problem is not on xbmc side but on the way your app send the requests Smile

It's basic http.

I had bug with UTF8 encoding request does your application does that ? if yes it should not Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Http API for Control40