nibe

package
v0.0.0-...-2c72a02 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ScopeRead = "READSYSTEM"
View Source
const ScopeWrite = "WRITESYSTEM"

Variables

View Source
var Endpoint = oauth2.Endpoint{
	AuthURL:   "https://api.nibeuplink.com/oauth/authorize",
	TokenURL:  "https://api.nibeuplink.com/oauth/token",
	AuthStyle: oauth2.AuthStyleInParams,
}

Functions

func GetAuthClient

func GetAuthClient(config *oauth2.Config, tokenFileName string) *http.Client

GetAuthClient retrieves a token, saves it, and returns the generated client.

Types

type Category

type Category struct {
	CategoryID string      `json:"categoryId"`
	Name       string      `json:"name"`
	Parameters []Parameter `json:"parameters"`
}

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string
	Verbose   bool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(httpClient *http.Client) *Client

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

func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)

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 GetServiceInfoCategoriesRequest

type GetServiceInfoCategoriesRequest struct {
	SystemID     int
	SystemUnitID int
	Parameters   bool
}

type GetServiceInfoCategoriesResponse

type GetServiceInfoCategoriesResponse []Category

type GetSystemParametersRequest

type GetSystemParametersRequest struct {
	SystemID     int
	ParameterIDs []string
}

type GetSystemParametersResponse

type GetSystemParametersResponse []Parameter

type GetSystemStatusRequest

type GetSystemStatusRequest struct {
	SystemID int
}

type GetSystemStatusResponse

type GetSystemStatusResponse []StatusIconItem

type Image

type Image struct {
	// Unique name for image
	Name string `json:"name"`
	// List of image sizes available
	Sizes []ImageSize `json:"sizes"`
}

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"`
}

Jump to

Keyboard shortcuts

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