Wiki source code of TCP Interface

Last modified by Mark Kohlmann on 2026/07/10 20:08

Hide last authors
Mark Kohlmann 6.1 1 ShowRunnerCLC™ can accept commands via TCP.  Feedback is provided if subscribed.
Mark Kohlmann 1.1 2
Mark Kohlmann 6.1 3 ==== System Configuration ====
4
5 Enable the TCP listener by specifying a port and the max connections via the console:
6 ##sr tcp enable (ListenPort) (MaxConnections)##
7 Example:
8 ##sr tcp enable 45794 20##
9
10 The TCP Listener may also be enabled by adding a snippet to the root of the config:
11
12 ## "TcpListener":
13 {
14 "ListenPort": 45794,
15 "MaxConnections": 20
16 },##
17
Mark Kohlmann 7.1 18 ----
Mark Kohlmann 1.1 19
Mark Kohlmann 7.1 20 ==== Global ID Action Command Format ====
21
Mark Kohlmann 1.1 22 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. 
23 Format: ##GlobalId.ActionName[.ActionPropertyValue]\x0D##
24
Mark Kohlmann 6.1 25 To obtain a list of GlobalIds for objects use console command sr show global ids.  Global Actions use a GlobalId of 0.
Mark Kohlmann 1.1 26
Mark Kohlmann 6.1 27 To obtain a list of Actions available by object type use console command ##sr show actions.##
Mark Kohlmann 1.1 28
29 Example Recall Scene 1 on Area 51:
30
Mark Kohlmann 6.1 31 From "##sr show global ids##":
32
Mark Kohlmann 1.1 33 ##+~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+
34 ~| ID | Type | Name |
35 +~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+
36 ~| 51 | Area | Boardroom A |
37 +~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-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-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+
44 ~| Area | RecallScene | Recalls the specified scene on this load | SceneId | False | Digital, Analog | 'SceneId'[[image:https://wiki.chiefintegrations.com/resources/icons/silk/emoticon_unhappy.png?cache-version=1594193432000||alt="emoticon_unhappy"]]Integer)'Scene Number to recall' |
45 +~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+##
46
47 TCP Command to send:
48
49 ##51.RecallScene.1\x0D##
50
51 ==== Subscriptions ====
52
Mark Kohlmann 2.1 53 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.
Mark Kohlmann 1.1 54
55 Subscribe:
56 ##+[GlobalId].[ActionName]\x0D##
57 +51.RecallScene\x0D
58
59 Unsubscribe:
60 ##-[GlobalId].[ActionName]\x0D##
61 -51.RecallScene\x0D
62
63 Reponse to Subscribe and Change of State Response:
64 ##[GlobalId].[ActionName]=[NewValue]\x0D##
65 ##51.RecallScene=0\x0D##
66
67 All response values are returned as numbers with 0 being false and 1 being true if the state is not a number.
Mark Kohlmann 7.1 68
69 ----
70
71 ==== AV Serial Protocol Command Format ====
72
73 ShowRunner v3.85 and newer supports using the [[AV Serial>>doc:SHOWRUNNER™ Integrations Guide.Integration Options.SHOWRUNNER™ Serial Interface.WebHome]] protocol over TCP in addition to the Global ID Action format.
Mark Kohlmann 1.1 74