Thermostat

class oemthermostat.Thermostat(host, port=80, username=None, password=None)

A class for interacting with the OpenEnergyMonitor Thermostat’s HTTP API.

Parameters:
  • host (str) – Hostname or IP address.
  • port (int (optional)) – The port of the web server.
  • username (str (optional)) – The username for HTTP auth.
  • password (str (optional)) – The password for the HTTP auth.

Attributes Summary

mode Returns the current mode of the thermostat.
setpoint Current thermostat setpoint in C
state Current state of the relay.
temperature Current value of the temperature sensor in C

Methods Summary

get(endpoint, **kwargs) Perform a GET request
post(endpoint, **kwargs) Perform a POST request
status() Get the status dictionary from the thermostat
switch() Change the state of the relay.

Attributes Documentation

mode

Returns the current mode of the thermostat.

Returns:mode0 for manual mode, 1 for schedule mode and 2 for manual mode.
Return type:int
setpoint

Current thermostat setpoint in C

state

Current state of the relay.

Returns:state – returns True if the relay is on and False if the relay is off.
Return type:bool
temperature

Current value of the temperature sensor in C

Methods Documentation

get(endpoint, **kwargs)

Perform a GET request

Parameters:
  • endpoint (str) – The endpoint to send the request to, will have ‘cgi’ appended to it.
  • kwargs (dict) – All other kwargs are passed to requests.get
Returns:

response – The result of the request.

Return type:

requests.Response

post(endpoint, **kwargs)

Perform a POST request

Parameters:
  • endpoint (str) – The endpoint to send the request to, will have ‘cgi’ appended to it.
  • kwargs (dict) – All other kwargs are passed to requests.post
Returns:

response – The result of the request.

Return type:

requests.Response

status()

Get the status dictionary from the thermostat

switch()

Change the state of the relay.