ecobee

package
v0.0.0-...-953b3d3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Scopes = []string{"smartRead", "smartWrite"}

Scopes defines the scopes we request from the API.

Functions

func SaveToken

func SaveToken(clientID string, cacheFile string, code string) error

SaveToken retreives a new token from ecobee and saves it to the auth cache after a pin/code combination has been added by an ecobee user.

func TokenSource

func TokenSource(clientID, cacheFile string) oauth2.TokenSource

Types

type Alert

type Alert struct {
	//	AcknowledgeRef       string `json:"acknowledgeRef"`
	//	Date                 string `json:"date"`
	//	Time                 string `json:"time"`
	//	Severity             string `json:"severity"`
	Text string `json:"text"`
	//	AlertNumber          int    `json:"alertNumber"`
	AlertType       string `json:"alertType"`
	IsOperatorAlert bool   `json:"isOperatorAlert"`
}

type Client

type Client struct {
	*http.Client
}

Client represents the Ecobee API client.

func NewClient

func NewClient(clientID, cacheFile string) *Client

NewClient creates a Ecobee API client for the specific clientID (Application Key). Use the Ecobee Developer Portal to create the Application Key. (https://www.ecobee.com/consumerportal/index.html#/dev)

func (*Client) GetThermostat

func (c *Client) GetThermostat(thermostatID string, opts ...SelectionOption) (*Thermostat, error)

func (*Client) GetThermostatSummary

func (c *Client) GetThermostatSummary(selection Selection) (map[string]ThermostatSummary, error)

func (*Client) GetThermostats

func (c *Client) GetThermostats(selection Selection) ([]Thermostat, error)

func (*Client) HoldTemp

func (c *Client) HoldTemp(thermostat string, heat, cool float64, d time.Duration) error

func (*Client) ResumeProgram

func (c *Client) ResumeProgram(id string, resumeAll bool) error

func (*Client) RunFan

func (c *Client) RunFan(id string, duration time.Duration) error

func (*Client) SendMessage

func (c *Client) SendMessage(thermostat, message string) error

func (*Client) UpdateThermostat

func (c *Client) UpdateThermostat(utr UpdateThermostatRequest) error

type Climate

type Climate struct {
	Name                string         `json:"name"`
	ClimateRef          string         `json:"climateRef"`
	IsOccupied          bool           `json:"isOccupied"`
	IsOptimized         bool           `json:"isOptimized"`
	CoolFan             string         `json:"coolFan"`
	HeatFan             string         `json:"heatFan"`
	Vent                string         `json:"vent"`
	VentilatorMinOnTime int            `json:"ventilatorMinOnTime"`
	Owner               string         `json:"owner"`
	Type                string         `json:"type"`
	Colour              int            `json:"colour"`
	CoolTemp            int            `json:"coolTemp"`
	HeatTemp            int            `json:"heatTemp"`
	Sensors             []RemoteSensor `json:"sensors"`
}

type EquipmentStatus

type EquipmentStatus struct {
	HeatPump, HeatPump2, HeatPump3, CompCool1, CompCool2, AuxHeat1, AuxHeat2, AuxHeat3, Fan, Humidifier, Dehumidifier, Ventilator, Economizer, CompHotWater, AuxHotWater bool
}

Not part of the API

func (*EquipmentStatus) Set

func (es *EquipmentStatus) Set(field string, state bool)

type Event

type Event struct {
	Type                   string `json:"type"`
	Name                   string `json:"name"`
	Running                bool   `json:"running"`
	StartDate              string `json:"startDate"`
	StartTime              string `json:"startTime"`
	EndDate                string `json:"endDate"`
	EndTime                string `json:"endTime"`
	IsOccupied             bool   `json:"isOccupied"`
	IsCoolOff              bool   `json:"isCoolOff"`
	IsHeatOff              bool   `json:"isHeatOff"`
	CoolHoldTemp           int    `json:"coolHoldTemp"`
	HeatHoldTemp           int    `json:"heatHoldTemp"`
	Fan                    string `json:"fan"`
	Vent                   string `json:"vent,omitempty"`
	VentilatorMinOnTime    int    `json:"ventilatorMinOnTime,omitempty"`
	IsOptional             bool   `json:"isOptional"`
	IsTemperatureRelative  bool   `json:"isTemperatureRelative"`
	CoolRelativeTemp       int    `json:"coolRelativeTemp"`
	HeatRelativeTemp       int    `json:"heatRelativeTemp"`
	IsTemperatureAbsolute  bool   `json:"isTemperatureAbsolute"`
	DutyCyclePercentage    int    `json:"dutyCyclePercentage"`
	FanMinOnTime           int    `json:"fanMinOnTime"`
	OccupiedSensorActive   bool   `json:"occupiedSensorActive,omitempty"`
	UnoccupiedSensorActive bool   `json:"unoccupiedSensorActive"`
	DrRampUpTemp           int    `json:"drRampUpTemp"`
	DrRampUpTime           int    `json:"drRampUpTime"`
	LinkRef                string `json:"linkRef,omitempty"`
	HoldClimateRef         string `json:"holdClimateRef,omitempty"`
}

type ExtendedRuntime

type ExtendedRuntime struct {
	LastReadingTimestamp     string   `json:"lastReadingTimestamp"`
	RuntimeDate              string   `json:"runtimeDate"`
	RuntimeInterval          int      `json:"runtimeInterval"`
	ActualTemperature        []int    `json:"actualTemperature"`
	ActualHumidity           []int    `json:"actualHumidity"`
	DesiredHeat              []int    `json:"desiredHeat"`
	DesiredCool              []int    `json:"desiredCool"`
	DesiredHumidity          []int    `json:"desiredHumidity"`
	DesiredDehumidity        []int    `json:"desiredDehumidity"`
	DmOffset                 []int    `json:"dmOffset"`
	HvacMode                 []string `json:"hvacMode"`
	HeatPump1                []int    `json:"heatPump1"`
	HeatPump2                []int    `json:"heatPump2"`
	AuxHeat1                 []int    `json:"auxHeat1"`
	AuxHeat2                 []int    `json:"auxHeat2"`
	AuxHeat3                 []int    `json:"auxHeat3"`
	Cool1                    []int    `json:"cool1"`
	Cool2                    []int    `json:"cool2"`
	Fan                      []int    `json:"fan"`
	Humidifier               []int    `json:"humidifier"`
	Dehumidifier             []int    `json:"dehumidifier"`
	Economizer               []int    `json:"economizer"`
	Ventilator               []int    `json:"ventilator"`
	CurrentElectricityBill   int      `json:"currentElectricityBill"`
	ProjectedElectricityBill int      `json:"projectedElectricityBill"`
}

type Function

type Function struct {
	Type   string      `json:"type"`
	Params interface{} `json:"params"`
}

type GetThermostatSummaryRequest

type GetThermostatSummaryRequest struct {
	Selection Selection `json:"selection"`
}

type GetThermostatSummaryResponse

type GetThermostatSummaryResponse struct {
	RevisionList    []string `json:"revisionList"`
	ThermostatCount int      `json:"thermostatCount"`
	StatusList      []string `json:"statusList"`
	Status          Status   `json:"status"`
}

type GetThermostatsRequest

type GetThermostatsRequest struct {
	Selection Selection `json:"selection"`
	Page      Page      `json:"page,omitempty"`
}

type GetThermostatsResponse

type GetThermostatsResponse struct {
	Page           Page
	ThermostatList []Thermostat `json:"thermostatList"`
	Status         Status       `json:"status"`
}

type Page

type Page struct {
	Page       int `json:"page,omitempty"`
	TotalPages int `json:"totalPages"`
	PageSize   int `json:"pageSize"`
	Total      int `json:"total"`
}

type PinResponse

type PinResponse struct {
	EcobeePin string `json:"ecobeePin"`
	Code      string `json:"code"`
}

func Authorize

func Authorize(clientID string) (*PinResponse, error)

Authorize retrieves an ecobee Pin and Code, allowing calling code to present them to the user outside of the ecobee request context. This is useful when non-interactive authorization is required. For example: an app being deployed and authorized using ansible, which does not support interacting with commands.

type Program

type Program struct {
	Schedule          [][]string `json:"schedule"`
	Climates          []Climate  `json:"climates"`
	CurrentClimateRef string     `json:"currentClimateRef"`
}

type RemoteSensor

type RemoteSensor struct {
	ID         string                   `json:"id"`
	Name       string                   `json:"name"`
	Type       string                   `json:"type"`
	Code       string                   `json:"code"`
	InUse      bool                     `json:"inUse"`
	Capability []RemoteSensorCapability `json:"capability"`
}

type RemoteSensorCapability

type RemoteSensorCapability struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

type ResumeProgramParams

type ResumeProgramParams struct {
	ResumeAll bool `json:"resumeAll"`
}

type Runtime

type Runtime struct {
	RuntimeRev         string `json:"runtimeRev"`
	Connected          bool   `json:"connected"`
	FirstConnected     string `json:"firstConnected"`
	ConnectDateTime    string `json:"connectDateTime"`
	DisconnectDateTime string `json:"disconnectDateTime"`
	LastModified       string `json:"lastModified"`
	LastStatusModified string `json:"lastStatusModified"`
	RuntimeDate        string `json:"runtimeDate"`
	RuntimeInterval    int    `json:"runtimeInterval"`
	ActualTemperature  int    `json:"actualTemperature"`
	ActualHumidity     int    `json:"actualHumidity"`
	RawTemperature     int    `json:"rawTemperature"`
	ShowIconMode       int    `json:"showIconMode"`
	DesiredHeat        int    `json:"desiredHeat"`
	DesiredCool        int    `json:"desiredCool"`
	DesiredHumidity    int    `json:"desiredHumidity"`
	DesiredDehumidity  int    `json:"desiredDehumidity"`
	DesiredFanMode     string `json:"desiredFanMode"`
	ActualVOC          int    `json:"actualVOC"`
	ActualCO2          int    `json:"actualCO2"`
	ActualAQAccuracy   int    `json:"actualAQAccuracy"`
	ActualAQScore      int    `json:"actualAQScore"`
	DesiredHeatRange   []int  `json:"desiredHeatRange"`
	DesiredCoolRange   []int  `json:"desiredCoolRange"`
}

type Selection

type Selection struct {
	SelectionType               string `json:"selectionType"`
	SelectionMatch              string `json:"selectionMatch"`
	IncludeRuntime              bool   `json:"includeRuntime"`
	IncludeExtendedRuntime      bool   `json:"includeExtendedRuntime"`
	IncludeElectricity          bool   `json:"includeElectricity"`
	IncludeSettings             bool   `json:"includeSettings"`
	IncludeLocation             bool   `json:"includeLocation"`
	IncludeProgram              bool   `json:"includeProgram"`
	IncludeEvents               bool   `json:"includeEvents"`
	IncludeDevice               bool   `json:"includeDevice"`
	IncludeTechnician           bool   `json:"includeTechnician"`
	IncludeUtility              bool   `json:"includeUtility"`
	IncludeManagement           bool   `json:"includeManagement"`
	IncludeAlerts               bool   `json:"includeAlerts"`
	IncludeWeather              bool   `json:"includeWeather"`
	IncludeHouseDetails         bool   `json:"includeHouseDetails"`
	IncludeOemCfg               bool   `json:"includeOemCfg"`
	IncludeEquipmentStatus      bool   `json:"includeEquipmentStatus"`
	IncludeNotificationSettings bool   `json:"includeNotificationSettings"`
	IncludePrivacy              bool   `json:"includePrivacy"`
	IncludeVersion              bool   `json:"includeVersion"`
	IncludeSecuritySettings     bool   `json:"includeSecuritySettings"`
	IncludeSensors              bool   `json:"includeSensors"`
	IncludeAudio                bool   `json:"includeAudio"`
}

type SelectionOption

type SelectionOption func(s Selection)

func WithIncludeAlerts

func WithIncludeAlerts(value bool) SelectionOption

func WithIncludeAudio

func WithIncludeAudio(value bool) SelectionOption

func WithIncludeDevice

func WithIncludeDevice(value bool) SelectionOption

func WithIncludeElectricity

func WithIncludeElectricity(value bool) SelectionOption

func WithIncludeEquipmentStatus

func WithIncludeEquipmentStatus(value bool) SelectionOption

func WithIncludeEvents

func WithIncludeEvents(value bool) SelectionOption

func WithIncludeExtendedRuntime

func WithIncludeExtendedRuntime(value bool) SelectionOption

func WithIncludeHouseDetails

func WithIncludeHouseDetails(value bool) SelectionOption

func WithIncludeLocation

func WithIncludeLocation(value bool) SelectionOption

func WithIncludeManagement

func WithIncludeManagement(value bool) SelectionOption

func WithIncludeNotificationSettings

func WithIncludeNotificationSettings(value bool) SelectionOption

func WithIncludeOemCfg

func WithIncludeOemCfg(value bool) SelectionOption

func WithIncludePrivacy

func WithIncludePrivacy(value bool) SelectionOption

func WithIncludeProgram

func WithIncludeProgram(value bool) SelectionOption

func WithIncludeRuntime

func WithIncludeRuntime(value bool) SelectionOption

func WithIncludeSecuritySettings

func WithIncludeSecuritySettings(value bool) SelectionOption

func WithIncludeSensors

func WithIncludeSensors(value bool) SelectionOption

func WithIncludeSettings

func WithIncludeSettings(value bool) SelectionOption

func WithIncludeTechnician

func WithIncludeTechnician(value bool) SelectionOption

func WithIncludeUtility

func WithIncludeUtility(value bool) SelectionOption

func WithIncludeVersion

func WithIncludeVersion(value bool) SelectionOption

func WithIncludeWeather

func WithIncludeWeather(value bool) SelectionOption

type SendMessageParams

type SendMessageParams struct {
	Alert
	Text string `json:"text"`
}

type SetHoldParams

type SetHoldParams struct {
	Event
	CoolHoldTemp   int    `json:"coolHoldTemp"`
	HeatHoldTemp   int    `json:"heatHoldTemp"`
	HoldClimateRef string `json:"holdClimateRef,omitempty"`
	StartDate      string `json:"startDate,omitempty"`
	StartTime      string `json:"startTime,omitempty"`
	EndDate        string `json:"endDate,omitempty"`
	EndTime        string `json:"endTime,omitempty"`
	HoldType       string `json:"holdType,omitempty"`
	HoldHours      int    `json:"holdHours,omitempty"`
}

type Status

type Status struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type Thermostat

type Thermostat struct {
	Identifier     string `json:"identifier"`
	Name           string `json:"name"`
	ThermostatRev  string `json:"thermostatRev"`
	IsRegistered   bool   `json:"isRegistered"`
	ModelNumber    string `json:"modelNumber"`
	Brand          string `json:"brand"`
	Features       string `json:"features"`
	LastModified   string `json:"lastModified"`
	ThermostatTime string `json:"thermostatTime"`
	UtcTime        string `json:"utcTime"`
	//Alerts         []Alert  `json:"alerts"`
	//Settings       Settings `json:"settings"`
	Runtime         Runtime         `json:"runtime"`
	ExtendedRuntime ExtendedRuntime `json:"extendedRuntime"`
	/// ...
	Events  []Event `json:"events"`
	Program Program `json:"program"`
	/// ...
	RemoteSensors []RemoteSensor `json:"remoteSensors"`
	Weather       Weather        `json:"weather"`
}

type ThermostatSummary

type ThermostatSummary struct {
	Identifier         string `json:"Identifier"`
	Name               string `json:"Name"`
	Connected          bool   `json:"Connected"`
	ThermostatRevision string `json:"ThermostatRevision"`
	AlertsRevision     string `json:"AlertsRevision"`
	RuntimeRevision    string `json:"RuntimeRevision"`
	IntervalRevision   string `json:"IntervalRevision"`
	EquipmentStatus
}

type ThermostatSummaryMap

type ThermostatSummaryMap map[string]ThermostatSummary

type UpdateThermostatRequest

type UpdateThermostatRequest struct {
	Selection Selection  `json:"selection"`
	Functions []Function `json:"functions"`
}

type UpdateThermostatResponse

type UpdateThermostatResponse struct {
	Status Status `json:"status"`
}

type Weather

type Weather struct {
	Timestamp      string            `json:"timestamp"`
	WeatherStation string            `json:"weatherStation"`
	Forecasts      []WeatherForecast `json:"forecasts"`
}

type WeatherForecast

type WeatherForecast struct {
	WeatherSymbol    int    `json:"weatherSymbol"`
	DateTime         string `json:"dateTime"`
	Condition        string `json:"condition"`
	Temperature      int    `json:"temperature"`
	Pressure         int    `json:"pressure"`
	RelativeHumidity int    `json:"relativeHumidity"`
	Dewpoint         int    `json:"dewpoint"`
	Visibility       int    `json:"visibility"`
	WindSpeed        int    `json:"windSpeed"`
	WindGust         int    `json:"windGust"`
	WindDirection    string `json:"windDirection"`
	WindBearing      int    `json:"windBearing"`
	Pop              int    `json:"pop"`
	TempHigh         int    `json:"tempHigh"`
	TempLow          int    `json:"tempLow"`
	Sky              int    `json:"sky"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL