RQ

From Makers Local 256
Jump to: navigation, search

Overview

Redqueen is a way to pass messages between all the iot devices we have at the shop in a way that is documented and expected.

Network Setup

We currently have two mqtt brokers setup, one that is local to the shop and is wide open for anything to send/receive. The other broker is located on our remote webserver and is exposed publicly with SSL and a username/password, meaning you will need to ask an Admin for access. All messages are mirrored between the brokers.

 Local only             Available from outside
--------------         --------------------------
| iot server |  <----> | remote.makerslocal.org |
--------------         --------------------------

Messages

Messages will be send in 1st person. As in "I (door) changed my status to open.". This is different than "Hey you, door....OPEN!".

MQTT Info

  • Currently we only support mqtt connects, and not websockets (maybe soon).
  • When connecting to mqtt be sure to set your clientid to something useful like 'rqirc'. This will help to determine who is causing problems if/when they do.

Local Host

  • type: mqtt
  • dns: iot
  • ip: 10.56.0.18
  • port: default, 1883
  • user/pass: Not needed

Remote Host

  • type: mqtt
  • host: 256.makerslocal.org
  • port: 35801
  • user/pass: Ask admin for access

Messages

IRC

rqirc will send out a message for thing like '!string'.

example: !alert I cut my finger off
ml256/irc/makerslocal/command/alert {"command":"alert", "channel":"#makerslocal", "user":"jimshoe", "message":"I cut my finger off"}

example: !shopstatus
ml256/irc/gen/command/shopstatus {"command":"shopstatus", "channel":"##gen", "user":"tylercrumpton", "message":""}

Temperature Sensors

Six Synapse Wireless Inc. RM-150 (unreleased & not-supported) wireless temperature sensors are placed around the building that check in every five minutes. They are currently located in the "kitchen", "office", "loft", "memberstorage", "fablab", and "tool" areas. The RM-150 in "memberstorage" has an additional external k-type themocouple input connected on "ext0".

Ambient temperature in tool area:

ml256/tool/temp/ambient {"units": "f", "sensor": "ambient", "temperature": 84.56, "location": "tool"}

Ambient temperature in the fablab:

ml256/kitchen/temp/ambient {"units": "f", "sensor": "ambient", "temperature": 83.66, "location": "kitchen"}

External thermocouple sensor temperature in member storage:

ml256/memberstorage/temp/ext0 {"units": "f", "sensor": "ext0", "temperature": 84.91999999999999, "location": "memberstorage"}

Wiki Changes

The wiki is using XMLRC plugin to send an xml message out over udp. Currently this is happing from remote->dev. On dev a small nodejs script is running that is converting the XML to JSON and sending it out over mqtt.

ml256/wiki/changes
{  
  "type":"edit",
  "ns":"2",
  "title":"User:Jimshoe",
  "rcid":"20018",
  "pageid":"1716",
  "revid":"19945",
  "old_revid":"19938",
  "user":"Jimshoe",
  "oldlen":"1147",
  "newlen":"1146",
  "timestamp":"2016-04-17T03:14:28Z",
  "comment":"spaces",
  "wikiid":"wikidb"
}

Big Sign

This is the big sign at the shop.

ml256/bigsign/alert {"source": "itsamenathan", "message": "this is only a test"}

CasCADE

This is the change machine at the shop.

Emitted when a withdrawal is made:

ml256/cascade/withdrawal {"user": "tylercrumpton", "amount": 0.50}

Also emitted when a withdrawal is made:

ml256/cascade/bank {"funds": 23.50}

Some errors are also emitted:

ml256/cascade/error {"error": "NO_MACHINE_FUNDS", "message": "Machine funds are depleted."}
ml256/cascade/error {"error": "NO_USER_FOUND", "message": "No user with that ID was found."}

Events

This is a message sent from eventwitter

ml256/event/reminder
 {
	"type": "VEVENT",
	"params": [],
	"start": "2016-05-10T23:30:00.000Z",
	"end": "2016-05-11T02:00:00.000Z",
	"uid": "19SAp3aKyx2KXESnxLzpFA",
	"summary": "Workshop Safety Class",
	"url": "http://ml256.org/w34w",
	"description": "http://ml256.org/w34w",
	"msg": "week"
}

History

This is the documentation for the current version of RedQueen. RedQueen is a documented way to pass messages between devices inside and outside the shop. We have gone through a few versions.

  • RQ/v1 - Initial ideas
  • RQ/v2 - Tyler's initial python bot, which is doing all the messages passing
  • RQ/v3 - Our attempt to use Couchdb to do all the message passing.
  • RQ/v4 - This page