Documentation ¶
Index ¶
- Constants
- Variables
- func GetAuthClient(config *oauth2.Config, tokenFileName string) *http.Client
- type Category
- type Client
- func (c *Client) GetServiceInfoCategories(request GetServiceInfoCategoriesRequest) (GetServiceInfoCategoriesResponse, error)
- func (c *Client) GetSystemParameters(request GetSystemParametersRequest) (GetSystemParametersResponse, error)
- func (c *Client) GetSystemStatus(request GetSystemStatusRequest) (GetSystemStatusResponse, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- func (c *Client) SetThermostat(request SetThermostatRequest) error
- type GetServiceInfoCategoriesRequest
- type GetServiceInfoCategoriesResponse
- type GetSystemParametersRequest
- type GetSystemParametersResponse
- type GetSystemStatusRequest
- type GetSystemStatusResponse
- type Image
- type ImageSize
- type Parameter
- type SetThermostatRequest
- type StatusIconItem
Constants ¶
const ScopeRead = "READSYSTEM"
const ScopeWrite = "WRITESYSTEM"
Variables ¶
var Endpoint = oauth2.Endpoint{ AuthURL: "https://api.nibeuplink.com/oauth/authorize", TokenURL: "https://api.nibeuplink.com/oauth/token", AuthStyle: oauth2.AuthStyleInParams, }
Functions ¶
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Verbose bool // contains filtered or unexported fields }
func NewClient ¶
NewClient returns a new NIBE API client. If a nil httpClient is provided, a new http.Client will be used. To use API methods which require authentication, provide an http.Client that will perform the authentication for you (such as that provided by the golang.org/x/oauth2 library).
func NewClientWithAuth ¶
func NewClientWithAuth(clientID, clientSecret, callbackURL, tokenFileName string, scopes []string) *Client
NewClientWithAuth returns a new NIBE API client using the supplied credentials.
func (*Client) GetServiceInfoCategories ¶
func (c *Client) GetServiceInfoCategories(request GetServiceInfoCategoriesRequest) (GetServiceInfoCategoriesResponse, error)
func (*Client) GetSystemParameters ¶
func (c *Client) GetSystemParameters(request GetSystemParametersRequest) (GetSystemParametersResponse, error)
func (*Client) GetSystemStatus ¶
func (c *Client) GetSystemStatus(request GetSystemStatusRequest) (GetSystemStatusResponse, error)
GetSystemStatus returns the current overall system status. This includes which system components (e.g. additional heating and accessories) are currently running as well as what the system is currently producing (e.g. hot water and heating). For systems with only one system unit containing a compressor module the function also returns whether any compressors or pumps belonging to this system unit is currently running. For larger systems you need to check each individual system unit's status to get their compressor and pump status.
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
func (*Client) SetThermostat ¶
func (c *Client) SetThermostat(request SetThermostatRequest) error
SetThermostat upload thermostat data to NIBE Uplink. Use the ExternalId parameter to identify which thermostat to update, if it does not already exist a thermostat with the supplied id will be created. Even though no change may have occured the thermostat needs to report its current status at least every 30 minutes to continue affecting the system.
type GetServiceInfoCategoriesResponse ¶
type GetServiceInfoCategoriesResponse []Category
type GetSystemParametersResponse ¶
type GetSystemParametersResponse []Parameter
type GetSystemStatusRequest ¶
type GetSystemStatusRequest struct {
SystemID int
}
type GetSystemStatusResponse ¶
type GetSystemStatusResponse []StatusIconItem
type ImageSize ¶
type ImageSize struct { // Width Width int `json:"width"` // Height Height int `json:"height"` // URL. Default URI-scheme and hostname when left out are https://www.nibeuplink.com URL string `json:"url"` }
type Parameter ¶
type Parameter struct { // Parameter id. ParameterID int `json:"parameterId"` // Name used for parameter in the request Name string `json:"name"` // Parameter title Title string `json:"title"` // Parameter designation Designation string `json:"designation"` // Unit Unit string `json:"unit"` // Human readable representation of the raw value DisplayValue string `json:"displayValue"` // Raw value, as handled by the system itself RawValue int `json:"rawValue"` }
type SetThermostatRequest ¶
type SetThermostatRequest struct { SystemID int // Id number set by the smart home system ExternalId int `json:"externalId"` // Human readable name for the thermostat Name string `json:"name"` // Optional, actual temperature in deg. Celsius, multiplied by 10. ActualTemp int `json:"actualTemp"` // Optional, target temperature in deg. Celsius, multiplied by 10. TargetTemp int `json:"targetTemp"` // Optional, valve position. Number of percent open. ValvePosition int `json:"valvePosition"` // Optional, list of climate systems this thermostat affects. ClimateSystems []int `json:"climateSystems"` }
type StatusIconItem ¶
type StatusIconItem struct { // Image Image Image `json:"image"` // Text displayed on top of / close to image to help describe the picture. // E.g. for a compressor it could contain the name of the compressor module. InlineText string `json:"inlineText"` // Title Title string `json:"title"` // List of parameters closely related to this item Parameters []Parameter `json:"parameters"` }