Mqtt

From Hive13 Wiki
Jump to navigation Jump to search



Hive13 Project
Hive13 MQTT Broker
200px
Status: Active
Project Owner: * Chris Davis
Project Location: https://cloudmqtt.com/ (currently)
Where to contribute: Ask
Start Date: 02/01/2021


Overview

Summary

A standard MQTT based service for data messaging for devices and systems around the Hive13 ecosystem.

Project Manager

TEAMCHRIS

Contributors

  • Add yourself here if you have contributed to this project.

Goal of the Project

What has been done

  • MQTT topics for badge reader & door sensor at street door & inside door
  • Topics for object detection on some security cameras at space

To-do items

  • Document MQTT credentials somehow
  • Use SSL for MQTT connection!
  • Look at setting up a local MQTT bridge which forwards to an Internet one. Perhaps require no username/password for the local one, only the Internet one.
  • Look into 'persistent' flag for MQTT topics which indicate more of a state than an event.
  • Get person detection code & setup into a git repo!
  • Document person detection JSON format

Project Details

Available Topics

Topic Message type Description
hive13/street_door/door_sensor Door Sensor Door sensor for 2701 street entrance
hive13/street_door/badge Badge Badge scanner at 2701 street entrance
hive13/trek_door/door_sensor Door Sensor Door sensor for 3rd floor "Star Trek" sliding door
hive13/trek_door/badge Badge Badge scanner at 3rd floor "Star Trek" sliding door
hive13/camera/detections Object Detection Summary of object detection on several security cameras

Always a WIP, should be able to query the broker to find out?

Message Types

Door Sensor

A string containing "open" or "closed", sent only upon a change in the door sensor's value.

Badge

A string containing the RFID badge number in the same format as should be present in the database. (See RFID Access.)

Object Detection

Work-in-progress. It's JSON for now. More formally:

  • Top-level keys: "summary" and "data":
    • "summary": Value is a dictionary containing summary counts for every object type used. Key: a string for the object type (e.g. "person"), value: a non-negative integer, the number of instance of that object detected. (This is redundant, and will equal the sum of the lengths of "object" lists in "data" for this object type across all cameras.)
    • "data": Value is a dictionary containing per-camera detections. Key: the camera's name (e.g. "woodshop"), value: another dictionary, explained below:
      • "time" key: Value is a Unix timestamp (i.e. seconds since epoch) for when this image was capture.
      • "objects" key: Value is a dictionary containing object probabilities. Key: a string for the object type (identical to the keys in "summary" above), value: a list of confidences (0.0-1.0) for each detection.

An example is below:

{
  "summary": {
    "dog": 0,
    "chair": 2,
    "person": 0
  },
  "data": {
    "laser_elevator": {
      "time": 1614128159,
      "objects": {
        "dog": [],
        "chair": [
          0.7249941229820251, 0.6910278797149
        ],
        "person": []
      }
    },
    "woodshop": {
      "time": 1614128159,
      "objects": {
        "dog": [],
        "chair": [],
        "person": []
      }
    }
  }
}

Work Log

This is a living log of work that has been completed on the machine.

February 01, 2021 - Nominal initial setup of broker

Picked date for pretty alliteration

February 09, 2021 - First Topics, Door Controller Connected

Door controller now sending events for door sensor open / closed and badge reading

February 11, 2021 - Starting to Document

February 21, 2021 - Changed topics, added object detection

Code was committed to door controller (previously it was running in-memory to check for stability).

Object detection is running experimentally (off of an NVidia Jetson running YOLOv3). JSON format is still being documented and possibly changed. If this works well, I (Hodapp) will move it to the space and set it to run this at startup.

February 21, 2021 - Mount Jetson; add example of object detection

Jetson TX1 dev board was put into the rack with a few other things. Annoyingly, it still does not boot unless the power button on the board is pressed when the board receives power - so it will not boot after a power outage.

Tried to document object detection JSON format