TerraController

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

TerraController

Postby tomavc » Fri Nov 01, 2019 12:10 pm

Has anybody succesfully controlled the TerraController with WD 6.1.0?
According to the Terra external control protocol I setup a tcp connection with port 23456 and the JSON command to apply a layout should be {"jsonrpc": "2.0", "method": "applylayoutbyname", "params": { "name": "LAYOUTNAME" }, "id": 1}.
When I send Tcpsend (1,"{"jsonrpc": "2.0", "method": "applylayoutbyname", "params": { "name": "LAYOUTNAME" }, "id": 1}") where "name" is the requested layout name the TerraController does not respond. Also when I try the JSON tester eg 192.168.50.130/jsontest the JSON tester appears but the command dropdownlist is empty.
Any suggesions?
tomavc
 
Posts: 5
Joined: Sun Mar 17, 2013 3:04 pm

Re: TerraController

Postby justyn roy » Sat Nov 02, 2019 8:24 pm

Hi!

Yes, I have a project or two using 6.0.1 and Terra.

There appear to be three issues here.

The first:
You need to send "[CR][LF]" at the end of your command.


Second - pay attention to your Quotation marks here:

You've properly put in TCPSend(1,"Command here") BUT - what is important, because this is JSON, we NEED to send the proper quotation marks downstream.
When you use double quotes in your Widget Command, you're starting and stopping your JSON string.
Instead, you need single quotes in the Widget Command to keep the double quotes in the JSON string in tact:

Code: Select all
Tcpsend(1,'{"jsonrpc": "2.0", "method": "applylayoutbyname", "params": { "name": "LAYOUTNAME" }, "id": 1}')



Third, you say "name" is the requested layout - this is the JSON Object that the Terra is calling, if you change "name", it won't be able to parse the "name" object location.
You need to change "LAYOUTNAME" to your layout name.

This way, the Terra will first see the Object location "method", which in this case is "applylayoutbyname".
Now Terra knows it only needs one object to complete this command - and it's looking for an object called "name".

As a note, the "id" integer at the end can be anything integer you want it to be, this is useful for parsing any returns/responses from the Terra.


Happy Widgeting!
Justyn Roy

Online Manual
User avatar
justyn roy
 
Posts: 132
Joined: Tue Sep 27, 2016 1:26 am

Re: TerraController

Postby tomavc » Sun Nov 03, 2019 8:26 pm

Hi Justyn.

Thanks for your reply and good to hear that it can work but...
I changed the quotation marks and added [CR][LF] inside the curly brackets like this:
Tcpsend(2, ' {"jsonrpc etc....."id": 1, "[CR][LF]"} ')
But no switching and the TCP input node gives this response from the controller:
{"jsonrpc":"2.0","id":null,"error": {"code":-32700,"message":"Parse Error"}}

The jsontester is working now and changes layouts as expected.

Where do I go wrong?

Rutger Flierman
NO&B Amsterdam
tomavc
 
Posts: 5
Joined: Sun Mar 17, 2013 3:04 pm

Re: TerraController

Postby tomavc » Wed Nov 06, 2019 5:16 pm

Hi Justyn,

it's working finally.
In WD 4.7 the Tcpsend command is more easy because there are no quotation marks needed.
The commands looks like this: Tcpsend.1.{"jsonrpc": "2.0", "method": "applylayoutbyname", "params": { "name": "LAYOUTNAME" }, "id": 1}') [CR][LF]

The Terra JSON manual is confusing because regarding the "layout by name command" the manual says that "name" is the name of the layout to be applied....

Happy Widgeting indeed :)
tomavc
 
Posts: 5
Joined: Sun Mar 17, 2013 3:04 pm

Re: TerraController

Postby justyn roy » Sun Nov 10, 2019 2:31 am

Great news that you have it working.

Yes, you're right, the syntax in Widget V4 is different than in V6.

I had assumed you were using V6 as you are posting in the V6 thread of this forum.

I'm happy it's working and that the manual is making more sense to you now.


Cheers!
Justyn Roy

Online Manual
User avatar
justyn roy
 
Posts: 132
Joined: Tue Sep 27, 2016 1:26 am


Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 14 guests