# MQTT API

Warning

This documentation is out of date. For more information please check Gateway Documentation at Software part of the Handbook.

# Configuration

Before starting integration process MQTT API should be configured. If you are not familiar with how to access and use Enapter Command Line interface please see Enapter Command Line Interface section of this documentation.

To do this - enter configuration mode on gateway shell and set basic parameters.

# Setup MQTT Port and Authentication

Public MQTT port is 9883.

set public-mqtt authentication username "public"
set public-mqtt authentication password "password"
commit
save

# Receiving device telemetry

  1. Connect to mqtt on gateway ip address, specified port, with specified username & password,
  2. Subscribe to telemetry topic.
mosquitto_sub -d -v -p 9883 -h 192.168.1.1 -u public -P password -t "telemetry/v1/<DEVICE_ID>"

# 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
}

# Device 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"
}

# Electrolyser V2.1 Protocol

    # Device Telemetry Payload

    Field Description
    electrolyte_downstream_temperature Downstream Temperature in Celsius
    electrolyte_level_high Indicates whether electrolyte level is higher than high level
    electrolyte_level_low Indicates whether electrolyte level is higher than low level
    electrolyte_level_medium Indicates whether electrolyte level is higher than medium level
    electrolyte_level_very_high Indicates whether electrolyte level is higher than very high level
    electrolyte_tank_temperature Electrolyte Tank Temperature in Celsius
    errors List of electrolyser errors (opens new window)
    h2_flow H2 Production in Normal Litre/hour
    h2_total Total H2 Produced in Normal Litre
    has_errors Indicates whether any device errors boolean
    has_warnings Indicates whether any device warnings boolean
    is_running Indicates whether device is running boolean
    outlet_pressure H2 Outlet Pressure in Bar
    production_rate Current electrolyser production rate in percents
    stack_amperage H2 Stack Amperage in Ampere
    stack_pressure H2 Stack Pressure in Bar
    stack_voltage H2 Stack Voltage in Volt
    status Electrolyser status string one of maintenance, expert, error, fatal, idle, steady, standby, curve, blowdown
    timestamp Message publishing timestamp
    warnings List of electrolyser warnings (opens new window)
    water_inlet_pressure Water Inlet Pressure in Bar
    water_refilling_valve_open Indicates whether water refilling valve is open state

    # Example

    {
      "electrolyte_downstream_temperature": 24.7,
      "electrolyte_level_high": false,
      "electrolyte_level_low": true,
      "electrolyte_level_medium": true,
      "electrolyte_level_very_high": false,
      "electrolyte_tank_temperature":  38.3,
      "errors": ["FP_01", "FP_03"],
      "h2_flow": 250.0,
      "h2_total": 10000,
      "has_errors":  true,
      "has_warnings": false,
      "is_running":  true,
      "outlet_pressure":  30.0,
      "production_rate": 100,
      "stack_amperage": 12.3,
      "stack_pressure": 30.1,
      "stack_voltage": 38.1,
      "status": "steady",
      "timestamp": 1514320289,
      "warnings": [],
      "water_inlet_pressure": 1.2,
      "water_refilling_valve_open": false
    }
    

    # Supported Commands

    Command Name Description Arguments
    start Start electrolyser
    stop Stop electrolyser
    reset Reset electrolyser
    set_production_rate Set electrolyser production rate (in percents) value (float)
    set_waterfill Force electrolyser to perform water refill operation value (boolean) (should be set to true)
    set_preheat Start electrolyser pre-heating value (boolean) (should be set to true)

    # Enapter Dryer Protocol

      # Device Telemetry Payload

      Field Description
      timestamp Message publishing timestamp
      status Dryer status string one of waiting_for_power, waiting_for_pressure, stopped_by_user, starting, standby, waiting_for_pressure, drying_0, cooling_0, switching_0, pressurizing_0, finalizing_0, drying_1, cooling_1, switching_1, pressurizing_1, finalizing_1, leak_input, leak_dryer, error
      is_running Indicates whether device is running boolean
      has_errors Indicates whether any device errors boolean
      errors List of dryer errors (opens new window)
      warnings List of dryer warnings (opens new window)
      input_pressure H2 Inlet Pressure in Bar
      output_pressure H2 Outlet Pressure in Bar

      # Example

      {
        "timestamp": 1547680704,
        "status": "drying_0",
        "is_running": true,
        "has_errors": true,
        "input_pressure": 30.5,
        "output_pressure": 26.1,
        "errors": ["TT00", "PT00"],
        "warings": []
      }
      

      # Supported Commands

      Command Name Description
      start Start dryer
      stop Stop dryer
      reset Reset dryer