Skip to content

Catalog

Paolo Grasso edited this page Jul 23, 2020 · 1 revision

General info

The resource catalog relies on five configuration files:

  • cherrypyconf: Configuration file for CherryPy webserver
  • conf.json: Configuration file which contains catalog ip, port and MQTT topic
  • static.json: Resource JSON where all information about the actors are stored
  • dynamic.json: Resource JSON where mutable information are stored. These include timestamps and topics for sensors, and current irrigation parameters.
  • api.json: Configuration files where critical information are stored (Telegram token, ThingSpeak IDs and APIs)

Execution

When launched, the catalog should:

  • Start a thread with CherryPy RESTful webserver
  • Start a thread with MQTT subscriber which listens to sensors alive messages
  • Start a thread which remove inactive sensors from dynamic.json

REST functions

  • It replies to requests containing broker IP, telegram token, ThingSpeak APIs, info related to a specific ID or the general JSON files.
  • It changes irrigation parameters on dynamic.json and irrigation hours on static/dynamic.json.
  • It is able to add gardens, plants and devices upon request. The new devIDs, plantIDs and gardenIDs are automatically generated in a sequential way.

MQTT functions:

  • It listens to all sensor topics (with wildcards) and keep tracks of active sensors by updating their timestamps on dynamic.json and deleting them when they are inactive.
Clone this wiki locally