API

You’ll find here all informations about Gladys architecture and its API.


Architecture

The overall architecture of Gladys 4 looks like this:

Gladys Assistant 4 Architecture


Data model

Here is the UML modelisation of Gladys Assistant 4:

Gladys Assistant 4 Architecture


REST API

Gladys REST API is entirely open!

You can find the documentation on https://apidoc.gladysassistant.com/.


MQTT API

If you configured a MQTT Broker with your Gladys installation, you have access to Gladys MQTT API.

Here are all the MQTT topics available, with examples of message to send:

Send Pod Heartbeat

This topic is used to tell Gladys that a pod is alive.

Topic:

/gladys/master/heartbeat

Body:

{
  "pod_selector": "raspberry-pi-zero-pod"
}

Declare a new Pod

This topic is useful to declare a new pod in Gladys.

Topic

/gladys/master/pod/create

Body:

{
  "name": "Raspberry Pi Zero Pod",
  "selector": "raspberry-pi-zero-pod"
}

Declare a new service

This topic is useful to declare a new service in Gladys.

Topic

/gladys/master/service/create

Body:

{
  "name": "Voice Recognition Service",
  "selector": "voice-recognition-service",
  "pod_id": "42c78884-af53-4514-974a-136fe07bd9e7",
  "version": "1.0.0",
  "has_message_feature": true
}

Create a device

Topic

/gladys/master/device/create

Body:

{
  "name": "New Lamp",
  "external_id": "philips-hue:1",
  "should_poll": false,
  "features": [
    {
      "name": "On/Off",
      "category": "light",
      "type": "binary",
      "read_only": false,
      "has_feedback": false,
      "min": 0,
      "max": 1
    }
  ]
}

Push a new device state

Topic:

gladys/master/device/state/update

Example 1:

{
  "device_feature_external_id": "philips-hue:1:binary",
  "state": 1
}