Components

Braubuddy brings together a number of components to control and monitor temperature.

_images/components.png

A growing list of thermometers, environmental controllers, thermostats and outputs are supported.

Consult the contribution guidelines if you’d like to request or contribute support for a particular component.

Thermometer

class braubuddy.thermometer.base.IThermometer

Interface for creating a thermometer for use with braudbuddy.

Auto

class braubuddy.thermometer.auto.AutoThermometer

Attempts to automatically discover a connected thermometer device.

  • If mutliple devices are connected, the first discovered device is

    returned.

  • If no devices are detected, a dummy device is returned.

TEMPer USB

class braubuddy.thermometer.temper_usb.TEMPerThermometer

TEMPer USB Thermometer manufactured by RDing.

Raises:braubuddy.thermometer.DeviceError if no TEMPer USB thermometer devices discovered.

DS18B20 GPIO

class braubuddy.thermometer.ds18b20_gpio.DS18B20Thermometer

DS18B20 GPIO anagolgue thermometer manufactured by Maxim Integrated Products.

Raises:braubuddy.thermometer.DeviceError if no DS18B20 thermometer devices discovered.

EnvController

Auto

class braubuddy.envcontroller.auto.AutoEnvController

Attempts to automatically discover a connected environmental controller device.

  • If mutliple devices are connected, the first discovered device is

    returned.

  • If no devices are detected, a dummy device is returned.

Tosr0x USB

class braubuddy.envcontroller.tosr0x_usb.Tosr0xEnvController(device_path=False)

Tosr0x family of relay modules manufactured by TinySine.

Relay 0 switches heating and relay 1 switches cooling.

Raises:braubuddy.envcontroller.DeviceError if no Tosr0x USB relay module devices discovered.

Thermostat

SimpleRanged

class braubuddy.thermostat.simpleranged.SimpleRangedThermostat(target, lower_out=2, lower_in=1, upper_in=1, upper_out=2)

A thermostat which uses an ‘upper’ temperature range to determine when to enable/disable cooling and a ‘lower’ temperature range to determine when to enable/disable heating.

Heating and cooling are both treated as boolean and thus are either on (100 percent) or off (0 percent).

The use of inner and outer values prevents flapping, (causing the heater or cooler to start and stop repeatedly). This is generally undesirable.

This is an example cycle against the upper range on a hot day:

  1. Heating and cooling are disabled.

  2. Temperature is rising, (it’s a hot day).

  3. Temperature rises above the upper_out threshold: Cooling is enabled.

  4. Temperature is dropping.

  5. Temperature drops below the upper_out threshold: Cooling remains

    enabled.

  6. Temperature drops below the upper_in threshold: Cooling is disabled.

  7. Temperature is rising.

  8. Temperature rises above the upper_in threshold: Cooling remains

    disabled.

  9. Repeat

Parameters:
  • lower_out (int) – Units below target at which heating will switch on.
  • lower_in (int) – Units below target at which heating will switch off.
  • upper_in (int) – Units above target at which cooling will switch off.
  • upper_out (int) – Units above target at which cooling will switch on.

Output

TextFile

class braubuddy.output.textfile.TextFileOutput(units='celsius', out_file='braubuddy.log', separator=' ', show_labels=False, show_units=True, show_timestamp=True, timestamp_format='%Y-%m-%d %H:%M:%S')

Output to text file.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • out_file (str) – Path to output file.
  • separator (str) – Separator between line output values.
  • show_labels (:class`bool`) – Add labels to output values, (e.g. ‘Temperature:40’).
  • show_units (bool) – Add units to output values, (e.g. ‘40°C’).
  • show_timestamp (bool) – Add timestamp to output values, (e.g. 2014-01-01 06:40 Temperature:40°C).
  • timetamp_format – A timestamp format parseable by datetime.datetime.strftime(), (e.g. ‘%Y-%m-%d %H:%M:%S’).

CSVFile

class braubuddy.output.csvfile.CSVFileOutput(units='celsius', out_file='braubuddy.csv', show_timestamp=True, timestamp_format='%Y-%m-%d %H:%M:%S')

Output to CSV file.

This is just a shortcut to create a TextFileOutput in CSV format.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • out_file (str) – Path to output file.
  • show_timestamp (bool) – Add timestamp to output values, (e.g. 2014-01-01 06:40 Temperature:40°C).
  • timetamp_format – A timestamp format parseable by datetime.datetime.strftime(), (e.g. ‘%Y-%m-%d %H:%M:%S’).

JSONFile

class braubuddy.output.jsonfile.JSONFileOutput(units='celsius', out_file='braubuddy.json', datapoint_limit=44640)

Output to JSON file.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • out_file (str) – Path to output file.
  • datapoint_limit (int (0 for unlimited)) – Maximum number of datapoints to store.

ImageFile

class braubuddy.output.imagefile.ImageFileOutput(units='celsius', out_file='braubuddy.png', out_format='png', chart_title='Braubuddy', chart_mins=10080, x_label_mins=60)

Output chart to an image file.

Note

Heating/cooling as bars with values on 2nd y axis are pending support for mixed bar/line graphs in pygal.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • image_path (str) – Path to image file.
  • image_format (str) – Image format (‘png’ or ‘svg’).
  • chart_title (str) – Chart title.
  • chart_mins (int) – Minutes of metric history to chart.
  • x_label_mins (int) – Minutes between timestamp labels on x axis.

GraphiteAPI

class braubuddy.output.graphiteapi.GraphiteAPIOutput(units='celsius', host='graphite.example.com', port=2003, prefix='braubuddy')

Output to the Graphite API.

Note

This output may also be used to publish to Hosted Graphite. Simply prepend the prefix kwarg with your API key as described in the Hosted Graphite docs.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • host (str) – Graphite host name or IP address.
  • port (class:int) – Graphite port.
  • prefix (str) – Graphite metric prefix.

LibratoAPI

class braubuddy.output.libratoapi.LibratoAPIOutput(units='celsius', username='myusername', token='mytoken', source='braubuddy')

Output to the Librato API.

Requires a Librato username and token, both found on the
Account Settings page.
Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • username (str) – Librato username.
  • token (class:str) – Librato token.
  • source (str) – Librato metric source.

DweetAPI

class braubuddy.output.dweetapi.DweetAPIOutput(units='celsius', frequency=86400, thing_name='braubuddy')

Output to the Dweet API.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • frequency (int) – Minimum seconds between dweets.
  • thing_name (str) – Dweet thing name, Replace this with something unique.

TwitterAPI

class braubuddy.output.twitterapi.TwitterAPIOutput(units='celsius', frequency=1440, message='Environment Status: Temp {temp}{units} | Target {target}{units} | Heat {heat}% | Cool {cool}% #braubuddy http://braubuddy.org')

Output to the Twitter API.

Note

When first run this output will attempt to authorise Braubuddy to publish to the user’s Twitter account. The resulting credentials are then retained for future use.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • frequency (int) – Minimum seconds between tweets.
  • message (str) –

    A template representing the message to be sent to Twitter. May include these variables for substitution:

    • temp (actual temperature)
    • target (target temperature)
    • units (temperature units)
    • heat (heater level)
    • cool (cooler level)

ListMemory

class braubuddy.output.listmemory.ListMemoryOutput(units='celsius', datapoint_limit=44640)

Output to a list in memory.

This is a special output used internally by the Braubuddy engine to store metrics for the dashboard and api. It could also be used by a thermostat if it required access to past data.

Parameters:
  • units (str) – Temperature units to output. Use ‘celsius’ or ‘fahrenheit’.
  • datapoint_limit (int (0 for unlimited)) – Maximum number of datapoints to store.

Braubuddy

A temperature management framework written in Python.

Navigation