Skip to content

API OS Time Series Database

ARIbemoss edited this page May 11, 2017 · 1 revision

Back to Developer Resources

Link 6: API between OS and BEMOSS Time-Series Database


Agents responsible for devices wishing to store data to the sMAP archiver need to publish their information (messages in JSON format) to the Information Exchange Bus (IEB) specifying a topic prefixed with datalogger/log. The rest of the topic is extracted and used as the path in sMAP for the data point. If the path already exists, the time series items will be added to the bottom of the list.

For example, if our source name is 'test data', and the topic we publish data to is datalogger/log/building1/zone1/testdata, then our data will be posted under building1/zone1/testdata in the source name 'test data'. To setup an sMAP source, the driver.ini file is needed.

Below are the steps to configure driver.ini file (run once during the BEMOSS platform initialization).

#!python

[report 0]
ReportDeliveryLocation = http://localhost:8079/add/BdEsx4qzBPtuibfDxcbFfUDFKwNXkVio0YFv

[/datalogger]
type = volttron.drivers.data_logger.DataLogger

[/]
type = Collection
Metadata/SourceName = BEMOSS data
uuid = 4a1ed488-a458-11e1-91af-00508dca5a06

[server]
Port = 8080

Topics to be Published to the IEB for Each Type of Device

For every device, the required meta data to make resource folders (topics) are as follows:

  1. building (e.g. building1, building2, building3, ...)
  2. zone (e.g. zone1, zone2, zone3, ..)
  3. device type (e.g. thermostat, plug load, lighting, sensor, powermeter)
  4. device id (e.g. qaz3m50)

For example, topic = 'datalogger/log/building1/zone1/thermostat/qaz3m50'


Data Logging Format

The content message of a data to be stored is in JSON format. The example is given as follow:

#!python

content = {
            "temperature": {
                    "Readings": [[mytime,self.get_variable("temperature")]],
                    "Units": "F",
                    "data_type": "double"
             },
	   "thermostat_mode": {
                    "Readings": [[mytime,float(self.get_variable("thermostat_mode"))]],
                    "Units": "N/A",
                    "data_type": "double"
             },
	   "heat_setpoint": {
                    "Readings": [[mytime,float(self.get_variable("heat_setpoint"))]],
                    "Units": "F",
                    "data_type": "double"
           }
	}


Back to Developer Resources

Clone this wiki locally