This page last changed on Jun 20, 2013 by juha.

Hi,

I'm using a command type tcp/ip to get the volume from my xbmc machine. The call works and the following is returned

{"id":1,"jsonrpc":"2.0","result":{"volume":87}}

The problem is in my command I've tried all sorts of regex to get the volume value, they all worked when tested on regexplanet.com, I even tried (87) as a test... however no matter what I do the entire response is passed to the linked sensor which then gives me the error in my dev log

2013-06-19 13:20:33,185 ERROR [Polling Sensor Thread ID = 2641718, Name ='volumeState']: Implementation error in protocol handler org.openremote.controller.protocol.socket.TCPSocketCommand@6348cda5 : For input string: "{"id":1,"jsonrpc":"2.0","result":{"volume":87}}"
java.lang.NumberFormatException: For input string: "{"id":1,"jsonrpc":"2.0","result":{"volume":87}}"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:481)
	at java.lang.Integer.valueOf(Integer.java:570)
	at org.openremote.controller.protocol.socket.TCPSocketCommand.read(TCPSocketCommand.java:235)
	at org.openremote.controller.model.sensor.Sensor$DeviceReader.read(Sensor.java:682)
	at org.openremote.controller.model.sensor.Sensor$DeviceReader.run(Sensor.java:608)
	at java.lang.Thread.run(Thread.java:679)
2013-06-19 13:20:33,186 TRACE [Polling Sensor Thread ID = 2641718, Name ='volumeState']: Processed 'N/A', received 'N/A'

So my first thought is, ok it looks like OR is ignoring my regex no matter what I put in there.

Can someone who knows OR better help please?

TCP command cannot have regex. Where did you even enter it?

Posted by mredeker at Jun 20, 2013 10:16

on the designer preview. Command, TCP/IP. The "Regular Expression" field is right there.

Also I'm sunning openremote controller 2.1.0_SNAPSHOT-2013-05-11

So does this mean its pending? The reason I'm using TCP/IP is XBMC is just too temperamental right now regarding the json api over http (using frodo 12.2) where as json over tcp/ip to xbmc port 9090 works like a charm.

Jon

Posted by jmspooner at Jun 20, 2013 10:41

Ok, I was not aware of the field in the preview.
Maybe Juha has already integrated an extension, but I cannot say anything about it.

Posted by mredeker at Jun 20, 2013 10:47

It has been integrated, see your JIRA task in ORCJAVA-298.

Integration was done in May 27th, so the May 11th snapshot doesn't include it. You'll need to upgrade to one of the June snapshots: http://download.openremote.org

Posted by juha at Jun 20, 2013 11:56

Thanks Juha for pointing it out.
I did not realize that the preview designer is already up-to-date for the latest snapshots.

Posted by mredeker at Jun 20, 2013 12:06

Many thanks, that snapshot works!

I'm using the command below to set the volume (also via a TCP/IP call), I assume my use of ${param} is correct? I ask as its not setting the volume and there are no errors in the logs, but have not had time to investigate yet.
I found the mention of ${param} in another thread on the forums.

{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": { "volume": [ ${param} ] }, "id": 1}

Again many thanks for your help

Posted by jmspooner at Jun 20, 2013 12:49

Yes, ${param} for the slider value is correct.

Posted by mredeker at Jun 20, 2013 13:10

Thanks for that, for anyone reading in future this works like a charm with the following command via tcp/ip port 9090. Just remember in xbmc to have the settings options for allow control of xbmc from other computers enabled.

{"jsonrpc": "2.0", "method": "Application.SetVolume", "params": { "volume": ${param} }, "id": 1}

Jon

Posted by jmspooner at Jun 20, 2013 13:20

Just thought I'd mention... in the stock release of the android console (from the play store) when a button has text it no longer shows the image. Also the slider control min/max images do not show.

To this end I installed the android app version 2.1.0 Beta from sourceforge. This version addresses the issues above as I'd expected.

However, the app does not adjust to the resolution of my phone, the interface only occupies 1/4 of the screen, all scaled down to fit.

Cheers

Posted by jmspooner at Jun 20, 2013 14:00

oh boy, I take that back. Just installed the standard version from the play store and that works on now. Ignore me, dense moment had

Posted by jmspooner at Jun 20, 2013 14:05
Document generated by Confluence on Jun 05, 2016 09:30