Work in progress API definition of the Remote Two/3 Dock WebSocket API.
API message status legend:
Icon | Description |
---|---|
đĄ | Idea, not yet official part of API definition. |
đ§ | Planned feature and most likely not (fully) implemented in the initial release. |
đˇ | API definition is work in progress, not ready yet for implementation. |
đ | API definition review & implementation. |
đ§Ş | API has been implemented in the Dock and is currently being tested. |
đ | Ready to use - feedback welcomed. |
2ď¸âŁď¸ | Only supported on Dock Two. |
3ď¸âŁď¸ | Only supported on Dock 3. |
The Remote Two/3 WebSocket Dock-API allows you to interact with the Unfolded Circle smart charging dock and take full control of its features.
This API is a beta version and does not yet contain all functionality.
Planned features:
The API is versioned according to SemVer.
The initial public release will be 1.0.0
once it is considered stable enough.
Any major version zero (0.y.z
) is for initial development and may change at any time!
I.e. backward compatibility for minor releases is not yet established, anything MAY change at any time!
get_sysinfo
The dock will send the auth_required
message right after the connection is established.
The client must reply with the auth
message containing the access token.
The dock replies with the authentication
event including the result code of the authentication:
200
: authentication succeeded, API can be used.401
: invalid authentication and the connection will be closed.Test docking station.
Dock-API for clients to interact with the docking station.
Accepts one of the following messages:
đ Authenticate a connection.
Sent by the client right after establishing a connection, or after an auth_required
request by the server.
{
"type": "auth",
"token": "1234"
}
đ Application level based ping to determine whether connection is alive.
Client can ping the server to determine whether connection is alive. Server responds with pong.
This is an application level ping as opposed to the standard WebSocket ping frames. This is only required if a client framework doesn't support WebSocket ping frames!
{
"type": "dock",
"msg": "ping"
}
đ Perform a system command.
The following system commands can be executed:
ir_receive_on
: Enables IR learning. ir_receive
event message.get_sysinfo
request.ir_receive_off
: Stops IR learning.remote_charged
: Set status LED to normal operation (LED off)remote_lowbattery
: Set status LED to low battery mode (blink twice every 4 seconds).remote_normal
: Set status LED to normal operation (LED off, turn on when charging).identify
: Docking station identification, blink status LED green, amber, blue and red.reboot
: Reboot the device.reset
: Factory reset the device.The server will respond with a result
message and a status code of the request.
âď¸ For reboot
and reset
commands there might be no response message. The dock will reboot after the command is processed.
{
"type": "dock",
"id": 0,
"command": "ir_receive_on"
}
đ Get system information.
Get hardware and software information about the device like serial number, model number, connection status and installed firmware version.
This message does not require authentication.
{
"type": "dock",
"id": 0,
"command": "get_sysinfo"
}
đ Send an IR code or continue repeating a previous code.
Send an IR code on the given output(s), either in Unfolded Circle or PRONTO HEX format.
int_side
is used as default output.The IR transmission begins after the full message has been received, parsed and validated. Depending on the state of the IR device, different actions are taken:
200
returned after completion.repeat
field set: return status code 202
and continue repeating
the IR code.429
.See Result codes below for all status codes.
This feature allows to repeat an IR signal autonomously by the dock for a specified number of times.
The repeated IR signal is usually a special IR command to tell the receiving device, that a button on a remote
control is hold for a longer time. Depending on the device, a repeat signal can either simply execute the same
action as if someone would rapidly press the same button, or it can adjust the command to a different function.
One common example is to progressively increase the volume steps, e.g. start slowly with 0.1 dBA steps, then
after a short time increase to 0.5 or 1 dBA steps.
Please note that not all devices or IR formats / commands support this feature. This is manufacturer specific.
The continuous IR repeat feature is activated with the optional repeat
field in the ir_send
command.
ir_send
request contains the same command
value, the repeat count will be reset and therefore
the repeat signal prolonged.ir_stop
request will stop the remaining repeat commands.format
, a repeat value might be already part of the code
.repeat
value will override the embedded repeat information.202
status code, unless it gets
disabled with the feature flag in bit 0.If not specified (or set to zero):
code
is sent as is, with the contained repeat information (depending on IR format).ir_send
command will send the full IR command.ir_stop
command will have no effect!pronto
: PRONTO HEX format:repeat
field is set (> 0), the 2nd burst pair sequence of the PRONTO code is repeated.hex
: Unfolded Circle format:repeat
field is set (> 0), this will override the repeat count in code
!200
: IR command has been sent. Either a single command, or after an IR repeat has finished.202
: IR repeat command accepted. Default behavior, except the response message has been disabled with the feature flag.400
: Cannot send command: invalid data or format.429
: Cannot send command: last IR command is still being sent.503
: IR sending not possible because learning is active.{
"type": "dock",
"id": 1,
"command": "ir_send",
"code": "4;0x10;12;0",
"format": "hex",
"int_side": true
}
{
"type": "dock",
"id": 2,
"command": "ir_send",
"code": "0000 006c 0022 0002 015b 00ad 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0622 015b 0057 0016 0e6c",
"format": "pronto",
"ext1": true
}
{
"type": "dock",
"id": 3,
"command": "ir_send",
"code": "4;0x10;12;1",
"format": "hex",
"repeat": 3,
"int_side": true
}
{
"type": "dock",
"id": 4,
"command": "ir_send",
"code": "0000 006c 0022 0002 015b 00ad 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0622 015b 0057 0016 0e6c",
"format": "pronto",
"repeat": 3,
"ext1": true
}
đ Stop an active IR repeat transmission.
This command stops an active IR repeat transmission at the end of the current repeat signal.
Status 200 is always returned, even if there's no active IR transmission.
{
"type": "dock",
"id": 0,
"command": "ir_stop"
}
đ Configure the dock.
Configure the dock with a custom friendly name, change the API access token and set the WiFi connection.
Notes:
ssid
and wifi_password
fields must be specified.get_sysinfo
.{
"type": "dock",
"id": 1,
"command": "set_config",
"friendly_name": "My dock"
}
{
"type": "dock",
"id": 2,
"command": "set_config",
"token": "1234"
}
{
"type": "dock",
"id": 3,
"command": "set_config",
"ssid": "My WiFi",
"wifi_password": "topsecret"
}
đ Set status LED brightness.
Set the maximum brightness of the status LED and ethernet indicator LED.
{
"type": "dock",
"id": 0,
"command": "set_brightness",
"status_led": 255,
"eth_led": 255
}
3ď¸âŁď¸ đ Set speaker volume.
{
"type": "dock",
"id": 0,
"command": "set_volume",
"volume": 100
}
2ď¸âŁ đ§Ş Configure logging parameters.
Set log level and an optional syslog server. Levels:
0
: EMERGENCY, system is unusable1
: ALERT, action must be taken immediately2
: CRITICAL, critical conditions3
: ERROR, error conditions4
: WARNING, warning conditions5
: NOTICE, normal but significant condition6
: INFO, informational7
: DEBUG, debug-level messagesâ ď¸ This feature is currently only available on Dock Two.
{
"type": "dock",
"id": 0,
"command": "set_logging",
"log_level": 7,
"syslog_server": "string",
"syslog_port": 514,
"syslog_enabled": true
}
3ď¸âŁď¸ đ§Ş Get external port configuration.
â ď¸ This feature is only available on Dock Three.
{
"type": "dock",
"id": 0,
"command": "get_port_mode",
"port": 1
}
3ď¸âŁď¸ đ§Ş Configure an external port.
â ď¸ This feature is only available on Dock Three.
{
"type": "dock",
"id": 0,
"command": "set_port_mode",
"port": 1,
"mode": "AUTO",
"uart": {
"baud_rate": 9600,
"data_bits": 8,
"stop_bits": "1",
"parity": "none"
}
}
3ď¸âŁď¸ đ§Ş Get all external port configurations.
â ď¸ This feature is only available on Dock Three.
{
"type": "dock",
"id": 0,
"command": "get_port_modes"
}
3ď¸âŁď¸ đ§Ş Set trigger state of an external port.
200
: trigger has been set.400
: invalid port number or unsupported command (on Dock Two).404
: port is not configured as trigger. 409
: conflict: impulse is already active.423
: port is temporarily unavailable. It might be reconfigured or is in use.500
: internal error.503
: port not available.
â ď¸ This feature is only available on Dock Three.{
"type": "dock",
"id": 0,
"command": "set_port_trigger",
"port": 1,
"trigger": true,
"duration": 1
}
3ď¸âŁď¸ đ§Ş Get trigger state of an external port.
â ď¸ This feature is only available on Dock Three.
{
"type": "dock",
"id": 0,
"command": "get_port_trigger",
"port": 1
}
Dock-API for clients to receive messages from the docking station.
Accepts one of the following messages:
đ Pong is a response to ping message.
Server pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard which is sent by client in response to a ping.
{
"type": "dock",
"msg": "pong"
}
đ Authentication response.
The authentication result is provided in the code
attribute:
200
: success, API can be used and message requests are accepted.401
: authentication failed, the provided API-key is not valid. The server will close the connection.{
"type": "auth",
"msg": "authentication",
"code": 200
}
đ Command result message.
Common response message properties.
{
"type": "dock",
"req_id": 0,
"msg": "string",
"code": 200,
"reboot": true
}
đ System information response.
{
"type": "dock",
"req_id": 2,
"msg": "get_sysinfo",
"code": 200,
"name": "My dock",
"hostname": "UC-Dock-1234",
"model": "UCD2",
"revision": "5.4",
"version": "0.4.0",
"serial": "0042",
"ir_learning": false
}
3ď¸âŁď¸ đ§Ş External port configuration.
â ď¸ This feature is only available on Dock Three.
{
"type": "dock",
"req_id": 0,
"msg": "get_port_mode",
"code": 200,
"reboot": true,
"port": 1,
"mode": "AUTO",
"active_mode": "AUTO",
"supported_modes": "AUTO",
"uart": {
"baud_rate": 9600,
"data_bits": 8,
"stop_bits": "1",
"parity": "none"
}
}
3ď¸âŁď¸ đ§Ş External port configurations.
â ď¸ This feature is only available on Dock Three.
{
"type": "dock",
"req_id": 0,
"msg": "get_port_modes",
"code": 200,
"reboot": true,
"ports": [
{
"port": 1,
"mode": "AUTO",
"active_mode": "AUTO",
"supported_modes": "AUTO",
"uart": {
"baud_rate": 9600,
"data_bits": 8,
"stop_bits": "1",
"parity": "none"
}
}
]
}
3ď¸âŁď¸ đ§Ş Trigger state of an external port.
200
: success.400
: invalid port number or unsupported command (on Dock Two).404
: port is not configured as trigger. 503
: port not available.{
"type": "dock",
"req_id": 0,
"msg": "get_port_trigger",
"code": 200,
"reboot": true,
"trigger": true
}
đ Authentication request event after connection is established.
The event contains additional metadata of the dock to inform the client of the specific dock model and firmware
version.
The client must authenticate with the auth
request message.
{
"type": "auth_required",
"model": "UCD2",
"revision": "5.4",
"version": "0.6.0"
}
đ IR learning event.
Sent whenever an IR code was learned in IR learning mode.
{
"type": "event",
"msg": "ir_receive",
"ir_code": "4;0x10;12;0"
}
3ď¸âŁď¸ đ§Ş IR-learning active event.
Sent when IR-learning has been activated.
â currently only available on Dock 3.
{
"type": "event",
"msg": "ir_receive_on"
}
3ď¸âŁď¸ đ§Ş IR-learning stopped event.
Sent when IR-learning has been stopped.
â currently only available on Dock 3.
{
"type": "event",
"msg": "ir_receive_off"
}
3ď¸âŁď¸ đ§Ş External port mode change event.
Sent when an external port mode was detected.
{
"type": "event",
"msg": "port_mode",
"port": 1,
"mode": "AUTO",
"active_mode": "AUTO",
"supported_modes": "AUTO",
"uart": {
"baud_rate": 9600,
"data_bits": 8,
"stop_bits": "1",
"parity": "none"
}
}
đ Generic request message.
Common request message properties.
đ Command result message.
Common response message properties.
đ Generic event message.
Common event message properties.
đ Authentication request event after connection is established.
The event contains additional metadata of the dock to inform the client of the specific dock model and firmware
version.
The client must authenticate with the auth
request message.
đ Authenticate a connection.
Sent by the client right after establishing a connection, or after an auth_required
request by the server.
đ Authentication response.
The authentication result is provided in the code
attribute:
200
: success, API can be used and message requests are accepted.401
: authentication failed, the provided API-key is not valid. The server will close the connection.đ Application level based ping to determine whether connection is alive.
Client can ping the server to determine whether connection is alive. Server responds with pong.
This is an application level ping as opposed to the standard WebSocket ping frames. This is only required if a client framework doesn't support WebSocket ping frames!
đ Pong is a response to ping message.
Server pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard which is sent by client in response to a ping.
đ Perform a system command.
The following system commands can be executed:
ir_receive_on
: Enables IR learning. ir_receive
event message.get_sysinfo
request.ir_receive_off
: Stops IR learning.remote_charged
: Set status LED to normal operation (LED off)remote_lowbattery
: Set status LED to low battery mode (blink twice every 4 seconds).remote_normal
: Set status LED to normal operation (LED off, turn on when charging).identify
: Docking station identification, blink status LED green, amber, blue and red.reboot
: Reboot the device.reset
: Factory reset the device.The server will respond with a result
message and a status code of the request.
âď¸ For reboot
and reset
commands there might be no response message. The dock will reboot after the command is processed.
đ Get system information.
Get hardware and software information about the device like serial number, model number, connection status and installed firmware version.
This message does not require authentication.
đ System information response.
đ Send an IR code or continue repeating a previous code.
Send an IR code on the given output(s), either in Unfolded Circle or PRONTO HEX format.
int_side
is used as default output.The IR transmission begins after the full message has been received, parsed and validated. Depending on the state of the IR device, different actions are taken:
200
returned after completion.repeat
field set: return status code 202
and continue repeating
the IR code.429
.See Result codes below for all status codes.
This feature allows to repeat an IR signal autonomously by the dock for a specified number of times.
The repeated IR signal is usually a special IR command to tell the receiving device, that a button on a remote
control is hold for a longer time. Depending on the device, a repeat signal can either simply execute the same
action as if someone would rapidly press the same button, or it can adjust the command to a different function.
One common example is to progressively increase the volume steps, e.g. start slowly with 0.1 dBA steps, then
after a short time increase to 0.5 or 1 dBA steps.
Please note that not all devices or IR formats / commands support this feature. This is manufacturer specific.
The continuous IR repeat feature is activated with the optional repeat
field in the ir_send
command.
ir_send
request contains the same command
value, the repeat count will be reset and therefore
the repeat signal prolonged.ir_stop
request will stop the remaining repeat commands.format
, a repeat value might be already part of the code
.repeat
value will override the embedded repeat information.202
status code, unless it gets
disabled with the feature flag in bit 0.If not specified (or set to zero):
code
is sent as is, with the contained repeat information (depending on IR format).ir_send
command will send the full IR command.ir_stop
command will have no effect!pronto
: PRONTO HEX format:repeat
field is set (> 0), the 2nd burst pair sequence of the PRONTO code is repeated.hex
: Unfolded Circle format:repeat
field is set (> 0), this will override the repeat count in code
!200
: IR command has been sent. Either a single command, or after an IR repeat has finished.202
: IR repeat command accepted. Default behavior, except the response message has been disabled with the feature flag.400
: Cannot send command: invalid data or format.429
: Cannot send command: last IR command is still being sent.503
: IR sending not possible because learning is active.đ Stop an active IR repeat transmission.
This command stops an active IR repeat transmission at the end of the current repeat signal.
Status 200 is always returned, even if there's no active IR transmission.
đ IR learning event.
Sent whenever an IR code was learned in IR learning mode.
3ď¸âŁď¸ đ§Ş IR-learning active event.
Sent when IR-learning has been activated.
â currently only available on Dock 3.
3ď¸âŁď¸ đ§Ş IR-learning stopped event.
Sent when IR-learning has been stopped.
â currently only available on Dock 3.
3ď¸âŁď¸ đ§Ş External port mode change event.
Sent when an external port mode was detected.
đ Configure the dock.
Configure the dock with a custom friendly name, change the API access token and set the WiFi connection.
Notes:
ssid
and wifi_password
fields must be specified.get_sysinfo
.đ Set status LED brightness.
Set the maximum brightness of the status LED and ethernet indicator LED.
3ď¸âŁď¸ đ Set speaker volume.
2ď¸âŁ đ§Ş Configure logging parameters.
Set log level and an optional syslog server. Levels:
0
: EMERGENCY, system is unusable1
: ALERT, action must be taken immediately2
: CRITICAL, critical conditions3
: ERROR, error conditions4
: WARNING, warning conditions5
: NOTICE, normal but significant condition6
: INFO, informational7
: DEBUG, debug-level messagesâ ď¸ This feature is currently only available on Dock Two.
3ď¸âŁď¸ đ§Ş Get external port configuration.
â ď¸ This feature is only available on Dock Three.
3ď¸âŁď¸ đ§Ş External port configuration.
â ď¸ This feature is only available on Dock Three.
3ď¸âŁď¸ đ§Ş Get all external port configurations.
â ď¸ This feature is only available on Dock Three.
3ď¸âŁď¸ đ§Ş External port configurations.
â ď¸ This feature is only available on Dock Three.
3ď¸âŁď¸ đ§Ş Configure an external port.
â ď¸ This feature is only available on Dock Three.
3ď¸âŁď¸ đ§Ş Set trigger state of an external port.
200
: trigger has been set.400
: invalid port number or unsupported command (on Dock Two).404
: port is not configured as trigger. 409
: conflict: impulse is already active.423
: port is temporarily unavailable. It might be reconfigured or is in use.500
: internal error.503
: port not available.
â ď¸ This feature is only available on Dock Three.3ď¸âŁď¸ đ§Ş Get trigger state of an external port.
â ď¸ This feature is only available on Dock Three.
3ď¸âŁď¸ đ§Ş Trigger state of an external port.
200
: success.400
: invalid port number or unsupported command (on Dock Two).404
: port is not configured as trigger. 503
: port not available.Common request message properties.
Common response message properties.
Common event message properties.
Request message ID which is reflected in response message.
One of the defined API message commands.
IR format:
hex
: Unfolded Circle format: <protocol>;<hex-ir-code>;<bits>;<repeat-count>
e.g. "4;0x640C;15;0"pronto
: PRONTO HEX format. Codes separated by space or comma.0000
).0000
can be specified as 0
, or 0010
as 10
.1-based port index number.
External port configuration.
mode
: configured operation mode.active_mode
: active operation mode, usually only set with the detected peripheral for mode: AUTO
.Common baud rate values: 300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
Stop bits must be set as string, number format is not supported!
Bit-field encoded feature flags. These are new or optional features a client can use. They also allow an easy way to keep backward compatibility. Available features:
ir_send
command supports the hold
parameter to send ir command for x milliseconds.