-
Notifications
You must be signed in to change notification settings - Fork 0
Sensors
Paolo Grasso edited this page Aug 20, 2020
·
2 revisions
A sensor script relies on a conf.json files which contains its devID, catalog IP and catalog port. It also uses some general functions stored in sensor_functions.py.
When launched, a sensor should:
- Get the current time (base time
BT). - Connect to MQTT broker.
- Start a thread which should:
- Ask the catalog gardenID, plantID and resources which are associated to the sensor, in order to build the MQTT topic.
- Publish «I’m alive» messages which are processed by the catalog.
- Start a thread which collect and publish environmental data every minute.
The format used for publishing MQTT messages is SenML. It consists in a JSON containing the following keys:
-
bn: It contains devID -
e: A list of events. Each one contains:-
n: Type of event (resource or alive) -
u: Unit of measurement of the resource -
t: timestamp referred to the basetimeBT -
v: value of the resource -
topic: topic (for alive messages)
-
Main scripts
Sensors
Control strategies
User interface