Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 1012 Bytes

README.md

File metadata and controls

44 lines (27 loc) · 1012 Bytes

activity-api

Listens to messages published to an MQTT broker by motion sensors and provides an HTTP API to the data.

Configuration

The main file app.py has two configuration variables near the top:

HISTORY_LENGTH

Determines how many values per sensor ID to keep in memory and return to clients.

Example:

HISTORY_LENGTH = 5

ALIASES

Provides a mapping from the sensor IDs to more human friendly names for the sensors. The format is a dictionary with id: aliaspairs

Example:

ALIASES = {"123456": "First test sensor", "999999": "The second test sensor"}

MQTT_URL

URL to the MQTT broker that we want to subscribe to.

Example:

MQTT_URL = "mqtt.yourdomain.tld"

TODO

  • Log the values into a database instead of into memory in order to not loose data on restarts

  • Make the aliases configurable in a database instead of hard coding and requiring a new deployment to change

  • Make the MQTT_URL an environment variable instead of hard-coding it in the source code