User Tools

Site Tools


mqtt

MQTT Message Bus

Hostname: mqtt.hacklab
Port: 1883

Sensors

Topic Payload Notes
sensor/g1/lightlevel 0-100
sensor/g1/temperature float, deg-C
sensor/g11/temperature/28767aa8040000cf float, deg-C Store Room, supply fan
sensor/g11/temperature/28c483a704000069 float, deg-C Store Room, extract fan
sensor/g11/temperature/28c893a704000068 float, deg-C Store Room, corridor outside
Topic Payload Notes
sensor/g1/pir (none) Sent when PIR sensor is triggered in G1
sensor/g2/pir (none) Sent when PIR sensor is triggered in G2
sensor/g8/pir (none) Sent when PIR sensor is triggered in G8
sensor/g11/pir (none) Sent when PIR sensor is triggered in G11
sensor/g1/presence active/idle/empty
sensor/g2/presence active/idle/empty
sensor/g8/presence active/idle/empty
sensor/g11/presence active/idle/empty
sensor/global/presence active/idle/empty Summary of the per-room status (e.g. if any room is “active” then the global output is also “active”)
sensor/g1/door open/closed/secure closed=“closed but unlocked”, secure=“closed and locked”
sensor/g2/door open/closed/secure
sensor/g8/door open/closed/secure
sensor/g11/door open/closed/secure
sensor/entrance/door open/closed/secure Do not use. No door sensor so always reports “open”
sensor/hgt/door open/closed/secure Do not use. No door sensor so always reports “open”
sensor/g1/window open/secure
sensor/g11/current/1 float, amps
Topic Payload Notes
sensor/discobot/input/<n> low, high General purpose inputs from the “discobot” board in G1

Lab Status

This sets the labs public open/closed status. Changing the value will cause an IRC notification and changes on SpaceAPI and the website. A notification will also appear on https://twitter.com/edinhacklabopen.

Topic Payload Notes
labstatus open, closed

When updating, the message should be sent with retain=True.

Tools

Topic Payload Notes
tool/lasercutter/active 0=no, 1=yes Is the laser cutter running a job?
tool/lasercutter/power 0-1023
tool/lasercutter/temperature/ambient float, deg-C Air temperature near the device
tool/lasercutter/temperature/reservoir float, deg-C Water temperature in the main reservoir
tool/lasercutter/temperature/chiller float, deg-C Water temperature in the chiller reservoir
tool/lasercutter/time/power float, seconds Time spent powered-up
tool/lasercutter/time/session float, seconds Time spent in a cutting session
tool/lasercutter/time/cutting float, seconds Time spent with the laser active
tool/lasercutter/time/analog float, seconds Time spent with the laser active, adjusted by power level
tool/lasercutter/pulse_count integer
tool/lasercutter/error_count integer
tool/lasercutter/combined_laser_stats json Legacy formatted data for compatibility with existing script
tool/lasercutter/combined_temperature_stats json Legacy formatted data for compatibility with existing script
tool/dustextractor 0=off, 1=on Control the big dust extractor in the workshop

Access-controlled tools (read-only values):

Topic Payload Notes
tool/<id>/status active, standby, idle, offline
tool/<id>/user string, username current or previous username
tool/<id>/current float, amps
tool/<id>/sketch_md5 string md5 of currently-running firmware

Environment

Topic Payload Notes
environment/g1/extractor 0=off, 1=on Note that the radio link for this is patchy so may not work immediately. Do not send multiple events to compensate as this should be done by the driver script instead.
environment/g1/heating 0-30, off Send a numeric value to set a target temperature for G1, off to turn the heating off

Displays

The Ferrograph Rhapsody LED Display is configured to display a list of message chunks on it's main scrolling area. Use the submessage topic below to add a message to the scroller. Messages time out after 10 minutes, so resend the message every 1-5 minutes using the same id.

Topic Payload Notes
display/rhapsody/submessage {“id”: “<uniq-ref>”, “message”: “text…”} Optional attributes: colour: red/yellow/green, priority: 1-100 (low values will be shown first, default=10)
display/rhapsody/raw raw data Send raw messages to Rhapsody display (not recommended)
display/rhapsody/reset Reset the Rhapsody display (only required if the display is corrupted)
Topic Payload Notes
display/mirrorball/lights 0=off, 1=on
display/mirrorball/speed 0-75

The ceiling lights in the main (G1) room are connected via a DALI bus. They can be controlled by selecting a preset, setting individual light levels or by passing a script.

Topic Payload Notes
dali/g1/preset/<preset> (none) preset=off/dim/bright/corners/movie/comfort/presentation/harmony/random or preset=<number>
dali/g1/set/<light-id> 0-254 light-id=0-17 or light-id=all
dali/g1/script json-formatted script

Doorbot is the wooden box by the door in G1, with two buttons and a 16×2 LCD:

Topic Payload Notes
display/doorbot/message text Two lines of 16 characters each. Use \n to separate lines.
display/doorbot/flash text As for message, but original message will be restored after 2 seconds.
display/doorbot/contrast 0-255
display/doorbot/backlight 0-255
display/doorbot/buttons/red/shortpress (none) Sent by device, do not write
display/doorbot/buttons/red/longpress (none) Sent by device, do not write
display/doorbot/buttons/red/state up, down Sent by device, do not write
display/doorbot/buttons/green/shortpress (none) Sent by device, do not write
display/doorbot/buttons/green/longpress (none) Sent by device, do not write
display/doorbot/buttons/green/state up, down Sent by device, do not write
access/entrance/request Button has been pressed at the entrance read only
access/entrance/release Release the entrance door (for 2 seconds)

G1 LED strip

Topic Payload Notes
display/g1/leds <colour> css3 web colours or hex values (e.g. ff0000)
display/g1/leds <preset> presets include: rainbow, zap, chase, test
display/g1/leds/brightness [0-100] changes the brightness of the leds to n percent

The LEDs can also be addressed in real time via a UDP network protocol. See this example.

Sound

Topic Payload Notes
sound/g1/play filename Sound files must be installed on squawk
sound/g1/speak text
sound/g1/announce text

JeeNode Radios

Topic Payload Notes
rf/jeenode868/received/<network>/<node> {“node”: 10, “line”: “OK 10 77 8 160 2”, “data”: “TQigAg==”, “network”: 38} Received message
rf/jeenode868/send binary data Transmit a message

OOK Radios

On-Off keying for remote controlled mains sockets.

Topic Payload Notes
rf/ook433/send/homeeasy2/<controller>/<device> 0, 1 controller=0-67108863 device=0-15
rf/ook433/send/homeeasy2/program/<controller>/<device> 0, 1

Space API

Space API is a standard for publishing data about Hackerspaces. Our data is generated at http://spaceapi.edinburghhacklab.com/spaceapi.json. The sensors section of the data can be extended by sending messages:

Topic Payload Notes
spaceapi/sensors/<type> json type is the sensor type as specified in the Space API specification. The payload is a JSON dictionary of the format given in the Space API specification.

e.g. a temperature reading - type=temperature

{
  "_ttl": 300,
  "location": "In a deep dark hole",
  "value": 3.14,
  "unit": "\u00b0C"
}

_ttl=300 will cause the entry to expire after 5 minutes (change this to be 2-3x your update interval).

IRC

Topic Payload Notes
irc/send JSON {“to”: “#edinhacklab”, “message”: “Hello World”}
irc/receive JSON {“channel”: “#edinhacklab”, “sender”: “timvik”, “message”: “Hello World”, “action”: false}
irc/status/connected (none) Read Only
irc/status/join JSON {“channel”: “#edinhacklab”, “user”: “timvik”} Read Only

Time Signals

These are beacons that can be used as time-based callbacks. This allows simple scripts to be written, driven only by incoming MQTT events.

Topic Payload Notes
timesignal/60 (none) Sent every 60 seconds by the “timesignal” script
timesignal/300 (none) Sent every 5 minutes
timesignal/600 (none)
timesignal/1800 (none)
timesignal/3600 (none)
timesignal/86400 (none)

Christmas Tree

Topic Payload Notes
xmas/tree <n> 0=off 1=red 2=dim-red 3=green 4=yellow 5=blue 6=magenta 7=cyan 8=white 9=colour-scroll 10=colour-fade 11=christmas 12=twinkle 13=nightlight
xmas/tree <colour> black/red/green/… (from the webcolors library) and hex RGB values (e.g. ff0000)
xmas/tree <name> Execute a saved script (e.g. chase, trail)
xmas/tree JSON Execute a script
xmas/tree/preset/<name> JSON Store a script for later use

In JSON mode, the payload is a sequence of frames and delay times. The following example would flash red/green/blue in 1000ms intervals.

[
  [[[255, 0, 0], [255, 0, 0], ...], 1000],
  [[[0, 255, 0], [0, 255, 0], ...], 1000],
  [[[0, 0, 255], [0, 0, 255], ...], 1000]
]

There are 50 pixels on our tree, so 50 RGB values should be sent in each frame.

Misc

Topic Payload Notes
stats/member_count n Number of members

TODO

  • Network devices
  • Door and window status
  • Shorekarn scrolling LED sign
  • IRC bot
mqtt.txt · Last modified: 2017-12-07 23:12 by tim