Command Port Syntax

Several parts of the HomeServer accepts commands. The command syntax used on these places is described here.

The syntax for the interface is ascii text where command elements are separated with comma “,” and each command and response are ended with [CR][LF]. If a parameter contains a “,” or any other quote character they should be quoted as follows:

  • , should be represented as: %2C
  • [CR] should be represented as: %0D
  • [LF] should be represented as: %0A
  • % should be represented as: %25

Each command response begins with the word ok followed by the result or the word error followed by an error code and an error string.

Commands

The following commands are supported by the command port:

  • dir - Returns a list of all instances in the HomeServer.
  • create,class name,instance name - Creates a new instance without activating it. A very strong convension is to start the new instance name with “#” and rename it without “#” when the instance is activated.
  • get,instance name{,attribute name} - Returns a list of name and value for the specified attribute. If no attribute name is specified all attributes of the instance are listed.
  • set,instance name,attribute name,value - Sets the attribute value in the specified instance. If the instance name begins with “#”, the attribute is initiated instead.
  • call,instance name,action name - Calls the specified method in the specified instance.
  • rename,current instance name,new instance name - Renames the instance
  • exec,command line - Executes the command line as an operating system command line in a separate process. This command is not allowed from remote sessions.
  • event,event type{,attribute name,attribute value}* - Sends an event with the specified attribute values.
  • subscribe - Start receive events from the event hub. After this command all events will be distributed over the connection for the duration of the session. Only valid for session based connections.
  • quit - Closes the session. Only valid for session based command ports.

Example 1 Command Port session

dir
ok,Event Broker,Bedroom Lamp,Hall Lamp,Bedroom Timer,Button,Gate Keeper,TCPListener Port,TCP Command Port,UDP Command Port,Temperature Log,UDP Listener,CPU Temp,CPU Temp Alarm,InternetRadio,Home-WAP,Home-Soap,WEB-Server
get,Bedroom Lamp
ok,State,Off,HouseCode,11111111,DeviceCode,1111,FHZ1000PcPort,NoPort
call,Bedroom Lamp,on
ok,
get,Bedroom Lamp,State
ok,State,On
get
error,2,No Instance specified

See also


Personal Tools