Documentation ¶
Index ¶
Constants ¶
const Bridge = "NXG"
const DepartureSwitch = "NXD"
const RollerShutter = "NXO"
const Sensor = "NXS"
Variables ¶
var Endpoint = oauth2.Endpoint{ AuthURL: "https://app.velux-active.com/oauth2/token", TokenURL: "https://app.velux-active.com/oauth2/token", AuthStyle: oauth2.AuthStyleInParams, }
Functions ¶
This section is empty.
Types ¶
type AuthTransport ¶
type AuthTransport struct { AppVersion string `json:"app_version"` UserPrefix string `json:"user_prefix"` }
AuthTransport can be used to add the required custom fields for an OAuth2 client using golang.org/x/oauth2.
Example: hc := &http.Client{Transport: &AuthTransport{VG: *vg}} ctx := context.WithValue(context.Background(), oauth2.HTTPClient, hc)
func DefaultAuthTransport ¶
func DefaultAuthTransport() *AuthTransport
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Verbose bool // contains filtered or unexported fields }
func NewClient ¶
NewClient returns a new Velux 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 ¶
NewClientWithAuth returns a new Velux API client using the supplied credentials.
func (*Client) GetHomesData ¶
func (c *Client) GetHomesData(request GetHomesDataRequest) (GetHomesDataResponse, error)
func (*Client) HomeStatus ¶
func (c *Client) HomeStatus(request HomeStatusRequest) (HomeStatusResponse, error)
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.
type GetHomesDataRequest ¶
type GetHomesDataRequest struct {
GatewayTypes []string `url:"gateway_types,omitempty"`
}
type GetHomesDataResponse ¶
type HomeStatusRequest ¶
type HomeStatusResponse ¶
type HomeStatusResponse struct { Body struct { Home struct { ID string `json:"id"` Rooms []struct { AirQuality int `json:"air_quality"` AlgoScheduleStart int `json:"algo_schedule_start"` AlgoStatus int `json:"algo_status"` AutoCloseTS int `json:"auto_close_ts"` CO2 int `json:"co2"` Humidity int `json:"humidity"` ID string `json:"id"` Lux int `json:"lux"` MaxComfortCO2 int `json:"max_comfort_co2"` MaxComfortHumidity int `json:"max_comfort_humidity"` MaxComfortTemperature int `json:"max_comfort_temperature"` MinComfortHumidity int `json:"min_comfort_humidity"` MinComfortTemperature int `json:"min_comfort_temperature"` Temperature int `json:"temperature"` } `json:"rooms"` } `json:"home"` } `json:"body"` }