# Protocol V1

# Connection to MQTT

Public MQTT port is 9883.

# Device Telemetry API

# Device Telemetry

Provides Device telemetry.

Will be published every 1 second.

telemetry/v1/{id}
Payload Field Description
timestamp Message publishing timestamp
... Device-specific fields

# Example

Topic

telemetry/v1/A0B1

Payload

{
  "timestamp": 1514320289,
  "uptime": 2
}

# Key/Value Storage API

# Set

Sets variable value.

variables/v1/set/{variable-name}
Payload Field Description
variable-name Variable name

# Example

Topic

variables/v1/set/pid_target_pressure

Payload

{
  "value": "30"
}

# Get

Receive notification on variable's value changes.

variables/v1/get/{variable-name}
Payload Field Description
variable-name Variable name

# Example

Topic

variables/v1/get/pid_target_pressure

Payload

{
  "timestamp": 1602699378,
  "value": "32"
}

# Commands API

# Request Command Execution

commands/v1/{id}/requests
Payload Field Description
id Command execution ID, e.g. UUID
name Command name
arguments Optional, command arguments
expires Optional, command expiration timestamp

# Example

Topic

commands/v1/A0B1/requests

Payload

{
  "id": "ab3e364c-cab2-4cc1-872d-4d554530d587",
  "name": "impulse",
  "arguments": {
    "id": 1,
    "impulse": 300
  }
}

# Command Execution Responses

commands/v1/{id}/responses
Payload Field Description
id Required, command execution ID, e.g. UUID
state Required, command execution state, e.g. started
payload Optional, command state payload

# Example

Topic

commands/v1/A0B1/responses

Payload

{
  "id": "ab3e364c-cab2-4cc1-872d-4d554530d587",
  "name": "finished"
}