MQTT

1. What it does

Allows you to publish events from Sleep as Android to any MQTT broker.

2. Where to find it

Settings → Services → Automation → MQTT

3. Guide

3.1. Setup

  1. Enable the MQTT option

  2. Tap the URL option and fill in the URL of the MQTT broker, including mqtt:// or mqtts:// or tcp://.

  3. Tap ok.

  4. (Optional) If you want to customize the client ID under which the app will connect to the MQTT Broker, you can do so by tapping Client ID option. By default, this is "SleepAsAndroid" and should be fine in case you’re the only one publishing to the broker through Sleep as Android.

3.2. Format of the POST request

On every event, Sleep as Android will publish a message to SleepAsAndroid topic in the following format:

{
    "event" : "event_name",
    "value1" : "",
    "value2" : "",
    "value3" : ""
}

The event field will have a value of one of the event names. The valueX fields will be only present if not empty.