Wiki source code of TCP Interface
Last modified by Mark Kohlmann on 2024/02/27 22:00
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | ShowRunnerCLC™ can accept commands via TCP. Feedback is provided if subscribed. | ||
| 2 | |||
| 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 | |||
| 18 | ==== Command Format ==== | ||
| 19 | |||
| 20 | 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. | ||
| 21 | Format: ##GlobalId.ActionName[.ActionPropertyValue]\x0D## | ||
| 22 | |||
| 23 | To obtain a list of GlobalIds for objects use console command sr show global ids. Global Actions use a GlobalId of 0. | ||
| 24 | |||
| 25 | To obtain a list of Actions available by object type use console command ##sr show actions.## | ||
| 26 | |||
| 27 | Example Recall Scene 1 on Area 51: | ||
| 28 | |||
| 29 | From "##sr show global ids##": | ||
| 30 | |||
| 31 | ##+~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+ | ||
| 32 | ~| ID | Type | Name | | ||
| 33 | +~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+ | ||
| 34 | ~| 51 | Area | Boardroom A | | ||
| 35 | +~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+## | ||
| 36 | |||
| 37 | From "##sr show actions##": | ||
| 38 | |||
| 39 | ##+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+ | ||
| 40 | ~| Type | Action | Description | Reference Property | Ref Req | Triggers | Supported Properties | | ||
| 41 | +~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+ | ||
| 42 | ~| 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' | | ||
| 43 | +~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~--+~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-+## | ||
| 44 | |||
| 45 | TCP Command to send: | ||
| 46 | |||
| 47 | ##51.RecallScene.1\x0D## | ||
| 48 | |||
| 49 | ==== Subscriptions ==== | ||
| 50 | |||
| 51 | 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. | ||
| 52 | |||
| 53 | Subscribe: | ||
| 54 | ##+[GlobalId].[ActionName]\x0D## | ||
| 55 | +51.RecallScene\x0D | ||
| 56 | |||
| 57 | Unsubscribe: | ||
| 58 | ##-[GlobalId].[ActionName]\x0D## | ||
| 59 | -51.RecallScene\x0D | ||
| 60 | |||
| 61 | Reponse to Subscribe and Change of State Response: | ||
| 62 | ##[GlobalId].[ActionName]=[NewValue]\x0D## | ||
| 63 | ##51.RecallScene=0\x0D## | ||
| 64 | |||
| 65 | All response values are returned as numbers with 0 being false and 1 being true if the state is not a number. | ||
| 66 |