TCP Interface

Last modified by Mark Kohlmann on 2024/02/27 22:00

ShowRunnerCLC™ can accept commands via TCP.  Feedback is provided if subscribed.

System Configuration

Enable the TCP listener by specifying a port and the max connections via the console:
sr tcp enable (ListenPort) (MaxConnections)
Example:
sr tcp enable 45794 20

The TCP Listener may also be enabled by adding a snippet to the root of the config:

  "TcpListener":
  {
    "ListenPort": 45794,
    "MaxConnections": 20
  },

Command Format

Commands are sent to objects by GlobalId followed by the Action and then any relevant Properties (Properties are interpreted in the order shown).  They are dot delimited and terminated with a carriage return. 
Format: GlobalId.ActionName[.ActionPropertyValue]\x0D

To obtain a list of GlobalIds for objects use console command sr show global ids.  Global Actions use a GlobalId of 0.

To obtain a list of Actions available by object type use console command sr show actions.

Example Recall Scene 1 on Area 51:

From "sr show global ids":

+-----+-----------------+----------------------------------+
| ID  | Type            | Name                             |
+-----+-----------------+----------------------------------+
| 51  | Area            | Boardroom A                      |
+-----+-----------------+----------------------------------+

From "sr show actions":

+-----------------+-------------------------------+----------------------------------------------------------+--------------------+---------+-----------------+--------------------------------------------------------------------------------+
| Type            | Action                        | Description                                              | Reference Property | Ref Req | Triggers        | Supported Properties                                                           |
+-----------------+-------------------------------+----------------------------------------------------------+--------------------+---------+-----------------+--------------------------------------------------------------------------------+
| Area            | RecallScene                   | Recalls the specified scene on this load                 | SceneId            | False   | Digital, Analog | 'SceneId'emoticon_unhappyInteger)'Scene Number to recall'                                    |
+-----------------+-------------------------------+----------------------------------------------------------+--------------------+---------+-----------------+--------------------------------------------------------------------------------+

TCP Command to send:

51.RecallScene.1\x0D

Subscriptions

Subscriptions may be enabled for each action.  When a subscription is requested the current state will be returned.  Any future changes to the actions state will return the value until the subscription is canceled.   A subscription request does not require parameters and does not execute the action.  "+" is used to subscribe, "-" is used to unsubscribe.  Subscriptions are tracked by connection.  If a connection is lost a re-subscribe should take place on a new connection.

Subscribe:
+[GlobalId].[ActionName]\x0D
+51.RecallScene\x0D

Unsubscribe:
-[GlobalId].[ActionName]\x0D
-51.RecallScene\x0D

Reponse to Subscribe and Change of State Response:
[GlobalId].[ActionName]=[NewValue]\x0D
51.RecallScene=0\x0D

All response values are returned as numbers with 0 being false and 1 being true if the state is not a number.