Documentation ¶
Overview ¶
Package ecobee provides a Go client for the ecobee API.
For more information about the ecobee API, see the documentation: https://www.ecobee.com/home/developer/api/introduction/index.shtml
Authentication ¶
By design, the ecobee Client accepts any http.Client so OAuth2 requests can be made by using the appropriate authenticated client. Use the https://github.com/golang/oauth2 package to obtain an http.Client which transparently authorizes requests.
Usage ¶
You use the library by creating a Client and invoking its methods. The client can be created manually with NewClient.
The below example illustrates how to:
- Fetch a persisted OAuth2 token from a file in JSON format if one exists.
- Authorize an app and create the OAuth2 token using the ecobee PIN authorization method if no persisted OAuth2 token is found.
- Create an http.Client using the OAuth2 token. The Client will auto-refresh the token as necessary.
- Create an ecobee.Client.
- Retrieve a selection of thermostat data for one or more thermostats.
- Retrieve the OAuth2 token from the ecobee.Client (In case it was auto-refreshed).
- Persist the OAuth2 token to a file in JSON format
package main import ( "bufio" "context" "encoding/json" "flag" "fmt" "io/ioutil" "os" "time" "golang.org/x/oauth2" "github.com/sherif-fanous/go-ecobee" "github.com/sherif-fanous/go-ecobee/objects" ) var applicationKey string var filename string var oauth2Endpoint = oauth2.Endpoint{ AuthURL: "https://api.ecobee.com/authorize", TokenURL: "https://api.ecobee.com/token", } func persistToken(oauth2Token *oauth2.Token) error { b, err := json.MarshalIndent(oauth2Token, "", " ") if err != nil { return err } if err := ioutil.WriteFile(filename, b, 0644); err != nil { return err } return nil } func fetchToken() (*oauth2.Token, error) { b, err := ioutil.ReadFile(filename) if err != nil { if os.IsNotExist(err) { return nil, nil } return nil, err } oauth2Token := oauth2.Token{} if err := json.Unmarshal(b, &oauth2Token); err != nil { return nil, err } return &oauth2Token, nil } func main() { flag.StringVar(&applicationKey, "key", "", "ecobee Application Key") flag.StringVar(&filename, "file", "", "token persistent store path") flag.Parse() oauth2Token, err := fetchToken() if err != nil { fmt.Println(err) return } if oauth2Token == nil { client := ecobee.NewClient() ctx := context.Background() ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() fmt.Println("PINAuthorization...Step #1") fmt.Println() authorizeResponse, err := client.PINAuthorization(ctx, applicationKey, ecobee.ScopeSmartWrite) if err != nil { fmt.Println(err) return } fmt.Printf("AuthorizeResponse %s\n", authorizeResponse) fmt.Println() fmt.Printf("Please goto ecobee.com, login to the web portal and click on the settings tab. "+ "Ensure the My Apps widget is enabled. If it is not click on the My Apps option in the menu on the left. "+ "In the My Apps widget paste '%s' in the textbox labelled 'Enter your 4 digit pin to install your third party app' "+ "and then click 'Install App'. The next screen will display any permissions the app requires and will ask you to click "+ "'Authorize' to add the application.\n\nAfter completing this step please hit 'Enter' to continue", authorizeResponse.PIN()) input := bufio.NewScanner(os.Stdin) input.Scan() fmt.Println() fmt.Println("PINAuthorization...Step #2") fmt.Println() nowUTC := time.Now().UTC() ctx = context.Background() ctx, cancel = context.WithTimeout(ctx, 5*time.Second) defer cancel() tokensResponse, err := client.RequestTokens(ctx, applicationKey, authorizeResponse.AuthorizationToken()) if err != nil { fmt.Println(err) return } fmt.Printf("TokensResponse %s\n", tokensResponse) oauth2Token = &oauth2.Token{ TokenType: tokensResponse.TokenType(), AccessToken: tokensResponse.AccessToken(), Expiry: nowUTC.Add(time.Second * time.Duration(tokensResponse.ExpiresIn())), RefreshToken: tokensResponse.RefreshToken(), } } oauth2Config := &oauth2.Config{ ClientID: applicationKey, Endpoint: oauth2Endpoint, } client := ecobee.NewClient(ecobee.WithHTTPClient(oauth2Config.Client(context.Background(), oauth2Token))) ctx := context.Background() ctx, cancel := context.WithTimeout(ctx, 5*time.Second) defer cancel() selection := objects.Selection{ SelectionType: ecobee.String("registered"), SelectionMatch: ecobee.String(""), IncludeSettings: ecobee.Bool(true), } thermostatResponse, err := client.Thermostat(ctx, &selection, nil) if err != nil { fmt.Println(err) return } fmt.Printf("ThermostatResponse %s\n", thermostatResponse) // Get the updated token oauth2Token = client.OAuth2Token() if err := persistToken(oauth2Token); err != nil { fmt.Println(err) return } }
Index ¶
- func Bool(b bool) *bool
- func Int(i int) *int
- func String(s string) *string
- func WithAPIBaseURL(apiBaseURL string) func(*Client)
- func WithAPIVersion(apiVersion int) func(*Client)
- func WithCustomHTTPHeaders(customHTTPHeaders map[string]string) func(*Client)
- func WithHTTPClient(httpClient *http.Client) func(*Client)
- type APIError
- type APIStatusResponse
- type AckType
- type AcknowledgeParameters
- type AuthorizationError
- type AuthorizationErrorResponse
- type Client
- func (c *Client) APIBaseURL() string
- func (c *Client) APIVersion() int
- func (c *Client) Acknowledge(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) ControlPlug(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) CreateVacation(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) CustomHTTPHeaders() map[string]string
- func (c *Client) DeleteVacation(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) Group(ctx context.Context, selection *objects.Selection) (*GroupSuccessResponse, error)
- func (c *Client) MeterReport(ctx context.Context, selection *objects.Selection, ...) (*MeterReportSuccessResponse, error)
- func (c *Client) OAuth2Token() *oauth2.Token
- func (c *Client) PINAuthorization(ctx context.Context, applicationKey string, scope Scope) (*PINAuthorizationSuccessResponse, error)
- func (c *Client) RequestTokens(ctx context.Context, applicationKey string, authorizationToken string) (*TokensSuccessResponse, error)
- func (c *Client) ResetPreferences(ctx context.Context, selection *objects.Selection) (*APIStatusResponse, error)
- func (c *Client) ResumeProgram(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) RuntimeReport(ctx context.Context, selection *objects.Selection, ...) (*RuntimeReportSuccessResponse, error)
- func (c *Client) SendMessage(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) SetHold(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) String() string
- func (c *Client) Thermostat(ctx context.Context, selection *objects.Selection, page *objects.Page) (*ThermostatSuccessResponse, error)
- func (c *Client) ThermostatSummary(ctx context.Context, selection *objects.Selection) (*ThermostatSummarySuccessResponse, error)
- func (c *Client) UnlinkVoiceEngine(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) UpdateGroup(ctx context.Context, selection *objects.Selection, groups []objects.Group) (*GroupSuccessResponse, error)
- func (c *Client) UpdateSensor(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- func (c *Client) UpdateThermostat(ctx context.Context, selection *objects.Selection, ...) (*APIStatusResponse, error)
- type ControlPlugParameters
- type CreateVacationParameters
- type DeleteVacationParameters
- type FanMode
- type GroupSuccessResponse
- type HoldType
- type MeterReportParameters
- type MeterReportSuccessResponse
- type MeterType
- type PINAuthorizationSuccessResponse
- func (a *PINAuthorizationSuccessResponse) AuthorizationToken() string
- func (a *PINAuthorizationSuccessResponse) ExpiresIn() int
- func (a *PINAuthorizationSuccessResponse) PIN() string
- func (a *PINAuthorizationSuccessResponse) PollingInterval() int
- func (a *PINAuthorizationSuccessResponse) Scope() Scope
- func (a *PINAuthorizationSuccessResponse) String() string
- func (a *PINAuthorizationSuccessResponse) UnmarshalJSON(data []byte) error
- type PlugState
- type ResumeProgramParameters
- type RuntimeReportParameters
- type RuntimeReportSuccessResponse
- func (m *RuntimeReportSuccessResponse) ReportList() []objects.RuntimeReport
- func (m *RuntimeReportSuccessResponse) SensorList() []objects.RuntimeSensorReport
- func (m *RuntimeReportSuccessResponse) Status() *objects.Status
- func (m *RuntimeReportSuccessResponse) String() string
- func (m *RuntimeReportSuccessResponse) UnmarshalJSON(data []byte) error
- type Scope
- type SendMessageParameters
- type SetHoldParameters
- type ThermostatSuccessResponse
- func (t *ThermostatSuccessResponse) Page() *objects.Page
- func (t *ThermostatSuccessResponse) Status() *objects.Status
- func (t *ThermostatSuccessResponse) String() string
- func (t *ThermostatSuccessResponse) ThermostatList() []objects.Thermostat
- func (t *ThermostatSuccessResponse) UnmarshalJSON(data []byte) error
- type ThermostatSummarySuccessResponse
- func (t *ThermostatSummarySuccessResponse) RevisionList() []string
- func (t *ThermostatSummarySuccessResponse) Status() *objects.Status
- func (t *ThermostatSummarySuccessResponse) StatusList() []string
- func (t *ThermostatSummarySuccessResponse) String() string
- func (t *ThermostatSummarySuccessResponse) ThermostatCount() int
- func (t *ThermostatSummarySuccessResponse) UnmarshalJSON(data []byte) error
- type TokensSuccessResponse
- func (t *TokensSuccessResponse) AccessToken() string
- func (t *TokensSuccessResponse) ExpiresIn() int
- func (t *TokensSuccessResponse) RefreshToken() string
- func (t *TokensSuccessResponse) Scope() Scope
- func (t *TokensSuccessResponse) String() string
- func (t *TokensSuccessResponse) TokenType() string
- func (t *TokensSuccessResponse) UnmarshalJSON(data []byte) error
- type UnlinkVoiceEngineParameters
- type UpdateSensorParameters
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAPIBaseURL ¶
WithAPIBaseURL returns a function that initializes a Client with an API base URL.
func WithAPIVersion ¶
WithAPIVersion returns a function that initializes a Client with an API version.
func WithCustomHTTPHeaders ¶
WithCustomHTTPHeaders returns a function that initializes a Client with custom HTTP headers.
func WithHTTPClient ¶
WithHTTPClient returns a function that initializes a Client with an HTTP client.
Types ¶
type APIError ¶
type APIError struct {
// contains filtered or unexported fields
}
APIError describes errors returned by the ecobee server while making requests
type APIStatusResponse ¶
type APIStatusResponse struct {
// contains filtered or unexported fields
}
APIStatusResponse describes responses returned by the ecobee server that only contain the Status object
func (*APIStatusResponse) Status ¶
func (a *APIStatusResponse) Status() *objects.Status
Status returns the response's status.
func (*APIStatusResponse) String ¶
func (a *APIStatusResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*APIStatusResponse) UnmarshalJSON ¶
func (a *APIStatusResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type AcknowledgeParameters ¶
type AcknowledgeParameters struct { // The thermostat identifier to acknowledge the alert for. ThermostatIdentifier *string // The acknowledge ref of alert. AckRef *string // The type of acknowledgement. AckType *AckType // Whether to remind at a later date, if this is a defer acknowledgement. RemindMeLater *bool }
An AcknowledgeParameters specifies the request parameters of the Acknowledge method.
type AuthorizationError ¶
type AuthorizationError struct {
// contains filtered or unexported fields
}
AuthorizationError describes errors returned by the ecobee server while authorizing
func (*AuthorizationError) Error ¶
func (e *AuthorizationError) Error() string
Error returns the string representation of an AuthorizationError.
type AuthorizationErrorResponse ¶
type AuthorizationErrorResponse struct {
// contains filtered or unexported fields
}
AuthorizationErrorResponse describes the error response returned by the ecobee server while authorizing.
func (*AuthorizationErrorResponse) ErrorDescription ¶
func (e *AuthorizationErrorResponse) ErrorDescription() string
ErrorDescription returns the response's error description.
func (*AuthorizationErrorResponse) ErrorType ¶
func (e *AuthorizationErrorResponse) ErrorType() string
ErrorType returns the response's error type.
func (*AuthorizationErrorResponse) ErrorURI ¶
func (e *AuthorizationErrorResponse) ErrorURI() string
ErrorURI returns the response's error URI.
func (*AuthorizationErrorResponse) UnmarshalJSON ¶
func (e *AuthorizationErrorResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client is an ecobee API client. Its zero value is not a usable ecobee client.
func NewClient ¶
func NewClient(optionalParameters ...clientOptionalParameters) *Client
NewClient initializes a new API client with default values. It takes functors to modify values when creating it
func (*Client) APIBaseURL ¶
APIBaseURL returns the client's API base URL.
func (*Client) APIVersion ¶
APIVersion returns the client's API version.
func (*Client) Acknowledge ¶
func (c *Client) Acknowledge(ctx context.Context, selection *objects.Selection, parameters *AcknowledgeParameters) (*APIStatusResponse, error)
Acknowledge allows an Alert to be acknowledged.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/Acknowledge.shtml
func (*Client) ControlPlug ¶
func (c *Client) ControlPlug(ctx context.Context, selection *objects.Selection, parameters *ControlPlugParameters) (*APIStatusResponse, error)
ControlPlug sets the on/off state of a plug by setting a hold on the plug.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/ControlPlug.shtml
func (*Client) CreateVacation ¶
func (c *Client) CreateVacation(ctx context.Context, selection *objects.Selection, parameters *CreateVacationParameters) (*APIStatusResponse, error)
CreateVacation creates a vacation event on the thermostat.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/CreateVacation.shtml
func (*Client) CustomHTTPHeaders ¶
CustomHTTPHeaders returns the client's custom HTTP headers.
func (*Client) DeleteVacation ¶
func (c *Client) DeleteVacation(ctx context.Context, selection *objects.Selection, parameters *DeleteVacationParameters) (*APIStatusResponse, error)
DeleteVacation deletes a vacation event from a thermostat.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/DeleteVacation.shtml
func (*Client) Group ¶
func (c *Client) Group(ctx context.Context, selection *objects.Selection) (*GroupSuccessResponse, error)
Group retrieves the grouping data for the thermostats registered to the particular user.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-group.shtml
func (*Client) MeterReport ¶
func (c *Client) MeterReport(ctx context.Context, selection *objects.Selection, parameters *MeterReportParameters) (*MeterReportSuccessResponse, error)
MeterReport retrieves the historical meter reading information for a selection of thermostats.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-meter-report.shtml
func (*Client) OAuth2Token ¶
OAuth2Token returns the client's OAuth2 token.
func (*Client) PINAuthorization ¶
func (c *Client) PINAuthorization(ctx context.Context, applicationKey string, scope Scope) (*PINAuthorizationSuccessResponse, error)
PINAuthorization requests an authorization code and a PIN to enable the authorization of an application within the ecobee Web Portal.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/auth/pin-api-authorization.shtml
func (*Client) RequestTokens ¶
func (c *Client) RequestTokens(ctx context.Context, applicationKey string, authorizationToken string) (*TokensSuccessResponse, error)
RequestTokens requests access and refresh tokens once the application is authorized within the ecobee Web Portal.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/auth/pin-api-authorization.shtml
func (*Client) ResetPreferences ¶
func (c *Client) ResetPreferences(ctx context.Context, selection *objects.Selection) (*APIStatusResponse, error)
ResetPreferences sets all of the user configurable settings back to the factory default values.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/ResetPreferences.shtml
func (*Client) ResumeProgram ¶
func (c *Client) ResumeProgram(ctx context.Context, selection *objects.Selection, parameters *ResumeProgramParameters) (*APIStatusResponse, error)
ResumeProgram removes the currently running event providing the event is not a mandatory demand response event.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/ResumeProgram.shtml
func (*Client) RuntimeReport ¶
func (c *Client) RuntimeReport(ctx context.Context, selection *objects.Selection, parameters *RuntimeReportParameters) (*RuntimeReportSuccessResponse, error)
RuntimeReport retrieves the historical runtime report information for a selection of thermostats.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-runtime-report.shtml
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, selection *objects.Selection, parameters *SendMessageParameters) (*APIStatusResponse, error)
SendMessage allows an alert message to be sent to the thermostat.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/SendMessage.shtml
func (*Client) SetHold ¶
func (c *Client) SetHold(ctx context.Context, selection *objects.Selection, parameters *SetHoldParameters) (*APIStatusResponse, error)
SetHold sets the thermostat into a hold with the specified temperature.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/SetHold.shtml
func (*Client) String ¶
String returns a string representing an indented JSON encoding of the client.
func (*Client) Thermostat ¶
func (c *Client) Thermostat(ctx context.Context, selection *objects.Selection, page *objects.Page) (*ThermostatSuccessResponse, error)
Thermostat retrieves a selection of thermostat data for one or more thermostats.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-thermostats.shtml
func (*Client) ThermostatSummary ¶
func (c *Client) ThermostatSummary(ctx context.Context, selection *objects.Selection) (*ThermostatSummarySuccessResponse, error)
ThermostatSummary retrieves a list of thermostat configuration and state revisions.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/get-thermostat-summary.shtml
func (*Client) UnlinkVoiceEngine ¶
func (c *Client) UnlinkVoiceEngine(ctx context.Context, selection *objects.Selection, parameters *UnlinkVoiceEngineParameters) (*APIStatusResponse, error)
UnlinkVoiceEngine disables the voice assistant for the selected thermostat.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/UnlinkVoiceEngine.shtml
func (*Client) UpdateGroup ¶
func (c *Client) UpdateGroup(ctx context.Context, selection *objects.Selection, groups []objects.Group) (*GroupSuccessResponse, error)
UpdateGroup updates the grouping data for the thermostats registered to the particular user.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/post-group-update.shtml
func (*Client) UpdateSensor ¶
func (c *Client) UpdateSensor(ctx context.Context, selection *objects.Selection, parameters *UpdateSensorParameters) (*APIStatusResponse, error)
UpdateSensor allows the caller to update the name of a remote sensor.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/functions/UpdateSensor.shtml
func (*Client) UpdateThermostat ¶
func (c *Client) UpdateThermostat(ctx context.Context, selection *objects.Selection, thermostat *objects.Thermostat, functions []objects.Function) (*APIStatusResponse, error)
UpdateThermostat permits the modification of any writable thermostat or sub-object property.
For more information see: https://www.ecobee.com/home/developer/api/documentation/v1/operations/post-update-thermostats.shtml
type ControlPlugParameters ¶
type ControlPlugParameters struct { // The name of the plug. PlugName *string // The state to put the plug into. PlugState *PlugState // The start date & time in thermostat time. StartDateTime *time.Time // The end date & time in thermostat time. EndDateTime *time.Time // The hold duration type. HoldType *HoldType // The number of hours to hold for. HoldHours *int }
A ControlPlugParameters specifies the request parameters of the ControlPlug method.
type CreateVacationParameters ¶
type CreateVacationParameters struct { // The vacation name to create. Name *string // The temperature to set the cool vacation hold at. CoolHoldTemp *int // The temperature to set the heat vacation hold at. HeatHoldTemp *int // The start date & time in thermostat time. StartDateTime *time.Time // The end date & time in thermostat time. EndDateTime *time.Time // The fan mode during the vacation. Fan *FanMode // The minimum number of minutes to run the fan each hour. FanMinOnTime *string }
A CreateVacationParameters specifies the request parameters of the CreateVacation method.
type DeleteVacationParameters ¶
type DeleteVacationParameters struct { // The vacation name to delete. Name *string }
A DeleteVacationParameters specifies the request parameters of the DeleteVacation method.
type GroupSuccessResponse ¶
type GroupSuccessResponse struct {
// contains filtered or unexported fields
}
GroupSuccessResponse describes the response returned by the ecobee server while retrieving or updating groups.
func (*GroupSuccessResponse) Groups ¶
func (g *GroupSuccessResponse) Groups() []objects.Group
Groups returns the response's groups.
func (*GroupSuccessResponse) Status ¶
func (g *GroupSuccessResponse) Status() *objects.Status
Status returns the response's status.
func (*GroupSuccessResponse) String ¶
func (g *GroupSuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*GroupSuccessResponse) UnmarshalJSON ¶
func (g *GroupSuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type MeterReportParameters ¶
type MeterReportParameters struct { // The report UTC start date. StartDate *time.Time // The report start interval. StartInterval *int // The report UTC end date. EndDate *time.Time // The report end interval. EndInterval *int // A CSV string of meter types. Meters []MeterType }
An MeterReportParameters specifies the request parameters of the MeterReport method.
type MeterReportSuccessResponse ¶
type MeterReportSuccessResponse struct {
// contains filtered or unexported fields
}
MeterReportSuccessResponse describes the success response returned by the ecobee server while retrieving a meter report.
func (*MeterReportSuccessResponse) ReportList ¶
func (m *MeterReportSuccessResponse) ReportList() []objects.MeterReport
ReportList returns the response's status report list.
func (*MeterReportSuccessResponse) Status ¶
func (m *MeterReportSuccessResponse) Status() *objects.Status
Status returns the response's status.
func (*MeterReportSuccessResponse) String ¶
func (m *MeterReportSuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*MeterReportSuccessResponse) UnmarshalJSON ¶
func (m *MeterReportSuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type MeterType ¶
type MeterType string
A MeterType specifies a meter type.
const (
MeterTypeEnergy MeterType = "energy"
)
Supported MeterType values.
type PINAuthorizationSuccessResponse ¶
type PINAuthorizationSuccessResponse struct {
// contains filtered or unexported fields
}
PINAuthorizationSuccessResponse describes the success response returned by the ecobee server while requesting the PIN.
func (*PINAuthorizationSuccessResponse) AuthorizationToken ¶
func (a *PINAuthorizationSuccessResponse) AuthorizationToken() string
AuthorizationToken returns the response's authorization token.
func (*PINAuthorizationSuccessResponse) ExpiresIn ¶
func (a *PINAuthorizationSuccessResponse) ExpiresIn() int
ExpiresIn returns the response's expires in.
func (*PINAuthorizationSuccessResponse) PIN ¶
func (a *PINAuthorizationSuccessResponse) PIN() string
PIN returns the response's PIN.
func (*PINAuthorizationSuccessResponse) PollingInterval ¶
func (a *PINAuthorizationSuccessResponse) PollingInterval() int
PollingInterval returns the response's polling interval.
func (*PINAuthorizationSuccessResponse) Scope ¶
func (a *PINAuthorizationSuccessResponse) Scope() Scope
Scope returns the response's scope.
func (*PINAuthorizationSuccessResponse) String ¶
func (a *PINAuthorizationSuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*PINAuthorizationSuccessResponse) UnmarshalJSON ¶
func (a *PINAuthorizationSuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type ResumeProgramParameters ¶
type ResumeProgramParameters struct { // Specifies whether the thermostat be resumed to next event (false) or to // it's program (true). ResumeAll *bool }
A ResumeProgramParameters specifies the request parameters of the ResumeProgram method.
type RuntimeReportParameters ¶
type RuntimeReportParameters struct { // The report UTC start date. StartDate *time.Time // The report start interval. StartInterval *int // The report UTC end date. EndDate *time.Time // The report end interval. EndInterval *int // A CSV string of column names. Columns *string // Whether to include sensor runtime report data IncludeSensor *bool }
An RuntimeReportParameters specifies the request parameters of the RuntimeReport method.
type RuntimeReportSuccessResponse ¶
type RuntimeReportSuccessResponse struct {
// contains filtered or unexported fields
}
RuntimeReportSuccessResponse describes the success response returned by the ecobee server while retrieving a runtime report.
func (*RuntimeReportSuccessResponse) ReportList ¶
func (m *RuntimeReportSuccessResponse) ReportList() []objects.RuntimeReport
ReportList returns the response's status report list.
func (*RuntimeReportSuccessResponse) SensorList ¶
func (m *RuntimeReportSuccessResponse) SensorList() []objects.RuntimeSensorReport
SensorList returns the response's status sensor list.
func (*RuntimeReportSuccessResponse) Status ¶
func (m *RuntimeReportSuccessResponse) Status() *objects.Status
Status returns the response's status.
func (*RuntimeReportSuccessResponse) String ¶
func (m *RuntimeReportSuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*RuntimeReportSuccessResponse) UnmarshalJSON ¶
func (m *RuntimeReportSuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type Scope ¶
type Scope string
Scope details the intent of the API application towards the user's account.
type SendMessageParameters ¶
type SendMessageParameters struct { // The message text to send. Text *string }
A SendMessageParameters specifies the request parameters of the SendMessage method.
type SetHoldParameters ¶
type SetHoldParameters struct { // The temperature to set the cool hold at. CoolHoldTemp *int // The temperature to set the heat hold at. HeatHoldTemp *int // The Climate to use as reference for setting the coolHoldTemp, // heatHoldTemp and fan settings. HoldClimateRef *string // The start date & time in thermostat time. StartDateTime *time.Time // The end date & time in thermostat time. EndDateTime *time.Time // The hold duration type. HoldType *HoldType // The number of hours to hold for. HoldHours *int }
A SetHoldParameters specifies the request parameters of the SetHold method.
type ThermostatSuccessResponse ¶
type ThermostatSuccessResponse struct {
// contains filtered or unexported fields
}
ThermostatSuccessResponse describes the success response returned by the ecobee server while retrieving thermostat data.
func (*ThermostatSuccessResponse) Page ¶
func (t *ThermostatSuccessResponse) Page() *objects.Page
Page returns the response's page.
func (*ThermostatSuccessResponse) Status ¶
func (t *ThermostatSuccessResponse) Status() *objects.Status
Status returns the response's status.
func (*ThermostatSuccessResponse) String ¶
func (t *ThermostatSuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*ThermostatSuccessResponse) ThermostatList ¶
func (t *ThermostatSuccessResponse) ThermostatList() []objects.Thermostat
ThermostatList returns the response's thermostat list.
func (*ThermostatSuccessResponse) UnmarshalJSON ¶
func (t *ThermostatSuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type ThermostatSummarySuccessResponse ¶
type ThermostatSummarySuccessResponse struct {
// contains filtered or unexported fields
}
ThermostatSummarySuccessResponse describes the success response returned by the ecobee server while retrieving thermostat configuration and state revisions.
func (*ThermostatSummarySuccessResponse) RevisionList ¶
func (t *ThermostatSummarySuccessResponse) RevisionList() []string
RevisionList returns the response's revision list.
func (*ThermostatSummarySuccessResponse) Status ¶
func (t *ThermostatSummarySuccessResponse) Status() *objects.Status
Status returns the response's status.
func (*ThermostatSummarySuccessResponse) StatusList ¶
func (t *ThermostatSummarySuccessResponse) StatusList() []string
StatusList returns the response's status list.
func (*ThermostatSummarySuccessResponse) String ¶
func (t *ThermostatSummarySuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*ThermostatSummarySuccessResponse) ThermostatCount ¶
func (t *ThermostatSummarySuccessResponse) ThermostatCount() int
ThermostatCount returns the response's thermostat count.
func (*ThermostatSummarySuccessResponse) UnmarshalJSON ¶
func (t *ThermostatSummarySuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type TokensSuccessResponse ¶
type TokensSuccessResponse struct {
// contains filtered or unexported fields
}
TokensSuccessResponse describes the success response returned by the ecobee server while requesting tokens.
func (*TokensSuccessResponse) AccessToken ¶
func (t *TokensSuccessResponse) AccessToken() string
AccessToken returns the response's access token.
func (*TokensSuccessResponse) ExpiresIn ¶
func (t *TokensSuccessResponse) ExpiresIn() int
ExpiresIn returns the response's expires in.
func (*TokensSuccessResponse) RefreshToken ¶
func (t *TokensSuccessResponse) RefreshToken() string
RefreshToken returns the response's refresh token.
func (*TokensSuccessResponse) Scope ¶
func (t *TokensSuccessResponse) Scope() Scope
Scope returns the response's scope.
func (*TokensSuccessResponse) String ¶
func (t *TokensSuccessResponse) String() string
String implements the fmt.Stringer interface. It returns a string representing an indented JSON encoding of the response.
func (*TokensSuccessResponse) TokenType ¶
func (t *TokensSuccessResponse) TokenType() string
TokenType returns the response's token type.
func (*TokensSuccessResponse) UnmarshalJSON ¶
func (t *TokensSuccessResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface.
type UnlinkVoiceEngineParameters ¶
type UnlinkVoiceEngineParameters struct { // The name of the engine to unlink. EngineName *string }
An UnlinkVoiceEngineParameters specifies the request parameters of the UnlinkVoiceEngine method.
type UpdateSensorParameters ¶
type UpdateSensorParameters struct { // Name specifies the updated name to give the sensor. Name *string // DeviceID specifies the deviceId for the sensor. DeviceID *string // SensorID specifies the identifier for the sensor. SensorID *string }
An UpdateSensorParameters specifies the request parameters of the UpdateSensor method