mqtt_historian.agent module

class mqtt_historian.agent.MQTTHistorian(connection, **kwargs)[source]

Bases: volttron.platform.agent.base_historian.BaseHistorian

This historian publishes data to a MQTT Broker.


Main publishing method for historian Agents.


to_publish_list (list) – List of records

to_publish_list takes the following form:

        'timestamp': timestamp1.replace(tzinfo=pytz.UTC),
        'source': 'scrape',
        'topic': "pnnl/isb1/hvac1/thermostat",
        'value': 73.0,
        'meta': {"units": "F", "tz": "UTC", "type": "float"}
        'timestamp': timestamp2.replace(tzinfo=pytz.UTC),
        'source': 'scrape',
        'topic': "pnnl/isb1/hvac1/temperature",
        'value': 74.1,
        'meta': {"units": "F", "tz": "UTC", "type": "float"}

The contents of meta is not consistent. The keys in the meta data values can be different and can change along with the values of the meta data. It is safe to assume that the most recent value of the “meta” dictionary are the only values that are relevant. This is the way the cache treats meta data.

Once one or more records are published either BaseHistorianAgent.report_all_handled() or BaseHistorianAgent.report_handled() must be called to report records as being published.

mqtt_historian.agent.historian(config_path, **kwargs)[source]
mqtt_historian.agent.main(argv=['/home/docs/checkouts/', '-T', '-E', '-b', 'html', '-d', '_build/doctrees', '-D', 'language=en', '.', '_build/html'])[source]