platform_driver.interfaces.ecobee module

class platform_driver.interfaces.ecobee.Hold(thermostat_identifier, read_only, readable, point_name, point_path, units, description='')[source]

Bases: platform_driver.interfaces.BaseRegister

Register to wrap around points contained in hold field of Ecobee API’s thermostat data response

get_state(ecobee_data)[source]
Parameters

ecobee_data – Ecobee data dictionary obtained from Driver HTTP Cache agent

Returns

Most recently available data for this setting register

set_state(value, access_token)[source]

Set Ecobee thermostat hold by configured point name and provided value dictionary :param value: Arbitrarily specified value dictionary. Ecobee API documentation provides best practice information for each hold. :param access_token: Ecobee access token to provide as bearer auth in request :return: request response values from settings request

class platform_driver.interfaces.ecobee.Interface(**kwargs)[source]

Bases: platform_driver.interfaces.BasicRevert, platform_driver.interfaces.BaseInterface

Interface implementation for wrapping around the Ecobee thermostat API

authorize_application()[source]
configure(config_dict, registry_config_str)[source]

Interface configuration callback :param config_dict: Driver configuration dictionary :param registry_config_str: Driver registry configuration dictionary

get_auth_config_from_store()[source]
Returns

Fetch currently stored auth configuration info from config store, returns empty dict if none is

present

get_data_cache(url, update_frequency)[source]

Fetches data from cache dict if it is up to date :param url: URL to use to use as lookup value in cache dict :param update_frequency: duration in seconds for which data in cache is considered up to date :return: Data stored in cache if up to date, otherwise None

get_data_remote(request_type, url, **kwargs)[source]

Make request to Ecobee remote API for “register” data, updating authorization tokens as necessary :param request_type: HTTP request type for making request :param url: URL corresponding to “register” data :param kwargs: HTTP request arguments :return: remote API response body

get_ecobee_data(request_type, url, update_frequency, refresh=False, **kwargs)[source]

Checks cache for up to date Ecobee data. If none is available for the URL, makes a request to remote Ecobee API. :param refresh: force Ecobee data to be obtained from the remote API rather than cache :param request_type: HTTP request type for request sent to remote :param url: URL of remote Ecobee API endpoint :param update_frequency: period for which cached data is considered up to date :param kwargs: HTTP request arguments :return: Up to date Ecobee data for URL

get_point(point_name, **kwargs)[source]

Return a point’s most recent stored value from remote API :param point_name: The name of the point corresponding to a register to get the state of :return: register’s most recent state from remote API response

get_thermostat_data(refresh=False)[source]

Collects most up to date thermostat object data for the configured Ecobee thermostat ID :param refresh: whether or not to force obtaining new data from the remote Ecobee API

parse_config(config_dict)[source]

Parse driver registry configuration and create device registers :param config_dict: Registry configuration in dictionary representation

refresh_tokens()[source]

Refresh Ecobee API authentication tokens via API endpoint - asks Ecobee to reset tokens then updates config with new tokens from Ecobee

request_tokens()[source]

Request up to date Auth tokens from Ecobee using API key and authorization code

store_remote_data(url, response)[source]

Store response body with a timestamp for a given URL :param url: url to use to use as lookup value in cache dict :param response: request response body to store in cache

update_auth_config()[source]

Update the platform driver configuration for this device with new values from auth functions

update_authorization()[source]
class platform_driver.interfaces.ecobee.Program(thermostat_identifier)[source]

Bases: platform_driver.interfaces.BaseRegister

Wrapper register for managing Ecobee thermostat programs, and getting program status

get_state(ecobee_data)[source]
Parameters

ecobee_data – Ecobee data dictionary obtained from Driver HTTP Cache agent

Returns

List of Ecobee event objects minus vacation events

set_state(program, access_token, resume_all=False)[source]

Set a new program, resume the next program on the programs stack, or “resume all” :param program: Program dictionary as specified by Ecobee API docs if setting a new program, else None :param access_token: Ecobee access token to provide as bearer auth in request :param resume_all: Whether or not to “resume all” if using the resume program function

class platform_driver.interfaces.ecobee.Setting(thermostat_identifier, read_only, readable, point_name, point_path, units, description='')[source]

Bases: platform_driver.interfaces.BaseRegister

Register to wrap around points contained in setting field of Ecobee API’s thermostat data response

get_state(ecobee_data)[source]
Parameters

ecobee_data – Ecobee data dictionary obtained from Driver HTTP Cache agent

Returns

Most recently available data for this setting register

set_state(value, access_token)[source]

Set Ecobee thermostat setting value by configured point name and provided value :param value: Arbitrarily specified value to request as set point :param access_token: Ecobee access token to provide as bearer auth in request :return: request response values from settings request

class platform_driver.interfaces.ecobee.Status(thermostat_identifier)[source]

Bases: platform_driver.interfaces.BaseRegister

Status request wrapper register for Ecobee thermostats. Note: There is a single status point for each thermostat, which is set by the device.

get_state(ecobee_data)[source]
Returns

List of currently running equipment connected to Ecobee thermostat

set_state(value, access_token)[source]

Set state is not supported for the static Status register.

class platform_driver.interfaces.ecobee.Vacation(thermostat_identifier)[source]

Bases: platform_driver.interfaces.BaseRegister

Wrapper register for adding and deleting vacations, and getting vacation status Note: Since vacations are transient, only 1 vacation register will be created per driver. The driver can be used to add, delete, or get the status of all vacations for the device

get_state(ecobee_data)[source]
Parameters

ecobee_data – Ecobee data dictionary obtained from Driver HTTP Cache agent

Returns

List of vacation dictionaries returned by Ecobee remote API

set_state(vacation, access_token, delete=False)[source]

Send delete or create vacation request to Ecobee API for the configured thermostat :param vacation: Vacation name for delete, or vacation object dictionary for create :param access_token: Ecobee access token to provide as bearer auth in request :param delete: Whether to delete the named vacation

platform_driver.interfaces.ecobee.call_grequest(method_name, url, **kwargs)[source]

Make grequest calls to remote api :param method_name: method type - put/get/delete :param url: http URL suffix :param kwargs: Additional arguments for http request :return: grequest response

platform_driver.interfaces.ecobee.make_ecobee_request(request_type, url, **kwargs)[source]

Wrapper around making arbitrary GET and POST requests to remote Ecobee API :return: Ecobee API response using provided request content

platform_driver.interfaces.ecobee.populate_selection_objects(access_token, selection_type, selection_match, specification)[source]

Utility method for generating set point request bodies for Ecobee remote api :param access_token: Ecobee access token from auth steps/configuration (bearer in request header) :param selection_type: Ecobee identity selection type :param selection_match: Ecobee identity selection match id :param specification: dictionary specifying the Ecobee object for updating the point on the remote API :return: request body JSON as dictionary

platform_driver.interfaces.ecobee.populate_thermostat_headers(access_token)[source]

Create populated header json as dictionary :param access_token: Ecobee “bearer” access token :return: header json as dictionary