Access Keys:
Skip to content (Access Key - 0)
 

IP device with JSON interface

Kris Meeus

On Mar 02, 2012 14:08

Hi all,

I'm new to OpenRemote, so I'm still struggling with finding my way. Installation and setup wend well.

I've a IP device which I would like to control with OpenRemote. The device has a Restful JSON interface.
So with a specific URL, a method e.g. [GET, PUT,DELETE] and a body e.g. {"action":{"on": true, "dimm":128}}.
For each message, a response is send back e.g. [ "action success"]

In the forums, I find a lot of posts about JSON, but I think they are internal related and not to a device...

What is the best way to control this device via OpenRemote?

Thanks in advance for your feedback!

Kind regards,

 
Labels:
Participants: Kris Meeus , Marcus Redeker , Richard West
  1. Apr 08, 2012

    Richard West says:

    Hi All, (Kris) bump Im also looking for an JSON interface, i like to see XBMC ...

    Hi All, (Kris)

    bump

    Im also looking for an JSON interface, i like to see XBMC template connection.
    is there a way to add JSON and/or XBMC as a protocol.

    i like to help with the development / testing / debugging of the protocol

    Kris < Did you already come up with a solution for your equipment?

    Greatz RWest (netherlands)

    1. Apr 09, 2012

      Marcus Redeker says:

      The current HTTP implementation only allows a GET method and no extra data (JSON...

      The current HTTP implementation only allows a GET method and no extra data (JSON workload) to be transmitted.
      We want to rewrite the HTTP implementation to be more flexible to allow this.
      If you know Java you can try yourself.

      UPDATE: I will spend some time on this now and see if I can implement basic REST support:

      • HTTP methods: GET, POST, PUT, DELETE
      • String as workload for JSON data
      • Maybe JSON parser to extract some data from a returned JSON result
      1. Apr 13, 2012

        Marcus Redeker says:

        A new version of HTTPCommand is available in my SVN workspace ".../workspace/mre...

        A new version of HTTPCommand is available in my SVN workspace ".../workspace/mredeker/Controller_2_0_0_Fixes" it supports three new parameter:

        • "method" to define one of GET, POST, PUT and DELETE (if none is given GET is default)
        • "workload" which can be String (eg. JSON data) which is send with the POST and PUT methods
        • "jsonpath" which can be used to extract data from a JSON response, examples can be found here: http://code.google.com/p/json-path/

        I was able to control the latest XBMC with this
        Here is an example to Play/Pause the XBMC Player with ID '0':

            <command id="26" protocol="http">
              <property name="workload" value="{&quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;Player.PlayPause&quot;, &quot;params&quot;: {&quot;playerid&quot;: 0}, &quot;id&quot;: 1}" />
              <property name="username" value="xbmc" />
              <property name="method" value="POST" />
              <property name="password" value="xbmc" />
              <property name="url" value="http://localhost:8888/jsonrpc" />
              <property name="name" value="XBMC_Player_PlayPause" />
            </command>
        
Adaptavist Theme Builder Powered by Atlassian Confluence