Skip to content

MQTT Format

Geoffrey Ottoy edited this page Feb 12, 2019 · 7 revisions

This document describes the format of the topics and messages of this project.

1. Format of topics

Generic format: SENSOR_TYPE/<own-id>/FUNCTION "message"

The <own-id> is formatted as <sensor-type>-<unique-id> where the <unique-id> is a 4 digit hex value. The <sensor-type> is defined in the format below.

2. Supported sensor types

Sensor Type Update Frequency
doorlock onChange
co2sensor every second
colorsensor every second
luxsensor every second
fireplace sensor onChange
curtain onChange
button onChange

3. MQTT message format per sensor type

3.1. Door Lock

3.1.1. Subscribes to

doorLock/all/set <msg>
doorlock/<own-id>/set <msg>

3.1.2. Publishes to

doorLock/<own-id>/status <msg>

3.1.3. Messages

  • "closed"
  • "open"

3.2. CO2

3.2.1. Publishes to

co2sensor/<own-id>/status <msg>

3.2.2. Messages

  • uint_16 formatted as string

3.3. Color

3.3.1. Publishes to

colorsensor/<own-id>/status <msg>

3.3.2. Messages

  • "#RRGGBB" (e.g., #d9d8c6)

3.4. Lux

3.4.1. Publishes to

luxsensor/<own-id>/status <msg>

3.4.2. Messages

  • float formatted as string

3.5. Fire place

3.5.1. Subscribes to

fireplace/all/set <msg>
fireplace/<own-id>/set <msg>

3.5.2. Publishes to

fireplace/<own-id>/status <msg>

3.5.3. Messages

  • "#RRGGBB" (e.g., #d9d8c6)

3.6. Curtain

3.6.1. Subscribes to

curtain/all/set 		<msg>
curtain/<own-id>/set 		<msg>

3.6.2. Publishes to

curtain/<own-id>/status 	<msg>

3.6.3. Messages

  • "up"
  • "down"
  • "going up" (status only)
  • "going down" (status only)

3.7. Button

3.7.1. Publishes to

button/<own-id>/status 	<msg>

3.7.2. Messages

  • "pressed"
  • "released"

4. Example usage of topics

  • Pull up the curtain-93a3 curtain: ´curtain/curtain-93a3/set "up"´
  • Listen to the status of a button: ´button/+/status´

4.1. Accessable sensors

  • co2sensor-0c02
  • doorlock-10cb
  • co2sensor-0c02
  • colorsensor-8421
  • luxsensor-4f23
  • fireplace-f17e
  • curtains-09e4
  • button-9b65

4.2. Application Notes

  • The application should allocate sensors to locations based on the sensor-id