Documentation ¶
Overview ¶
Package miele implements a client for the Miele 3rd Party API. See https://www.miele.com/developer/swagger-ui/index.html.
Index ¶
- Constants
- Variables
- type AuthTransport
- type Client
- func (c *Client) DeviceAction(deviceID string, request DeviceActionRequest) error
- func (c *Client) GetDevice(deviceID string, request GetDeviceRequest) (Device, error)
- func (c *Client) GetDeviceActions(deviceID string, request GetDeviceActionsRequest) (GetDeviceActionsResponse, error)
- func (c *Client) GetDeviceIdent(deviceID string, request GetDeviceStateRequest) (Ident, error)
- func (c *Client) GetDeviceState(deviceID string, request GetDeviceStateRequest) (State, error)
- func (c *Client) ListDevices(request ListDevicesRequest) (ListDevicesResponse, error)
- func (c *Client) ListShortDevices(request ListShortDevicesRequest) (ListShortDevicesResponse, error)
- func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error)
- type Device
- type DeviceAction
- type DeviceActionRequest
- type DeviceIdentLabel
- type GetDeviceActionsRequest
- type GetDeviceActionsResponse
- type GetDeviceIdentRequest
- type GetDeviceRequest
- type GetDeviceStateRequest
- type Ident
- type ListDevicesRequest
- type ListDevicesResponse
- type ListShortDevicesRequest
- type ListShortDevicesResponse
- type LocalizedRequest
- type LocalizedValue
- type ShortDevice
- type State
- type XkmIdentLabel
Constants ¶
const ( DEVICE_TYPE_WASHING_MACHINE = 1 DEVICE_TYPE_TUMBLE_DRYER = 2 DEVICE_TYPE_DISHWASHER = 7 DEVICE_TYPE_OVEN = 12 DEVICE_TYPE_OVEN_MICROWAVE = 13 DEVICE_TYPE_HOB_HIGHLIGHT = 14 DEVICE_TYPE_STEAM_OVEN = 15 DEVICE_TYPE_MICROWAVE = 16 DEVICE_TYPE_COFFEE_SYSTEM = 17 DEVICE_TYPE_HOOD = 18 DEVICE_TYPE_FRIDGE = 19 DEVICE_TYPE_FREEZER = 20 DEVICE_TYPE_FRIDGE_FREEZER_COMBINATION = 21 DEVICE_TYPE_VACUUM_CLEANER = 23 DEVICE_TYPE_WASHER_DRYER = 24 DEVICE_TYPE_DISH_WARMER = 25 DEVICE_TYPE_HOB_INDUCTION = 27 DEVICE_TYPE_STEAM_OVEN_COMBINATION = 31 DEVICE_TYPE_WINE_CABINET = 32 DEVICE_TYPE_WINE_CONDITIONING_UNIT = 33 DEVICE_TYPE_WINE_STORAGE_CONDITIONING_UNIT = 34 DEVICE_TYPE_STEAM_OVEN_MICROWAVE_COMBINATION = 45 DEVICE_TYPE_VACUUM_DRAWER = 48 DEVICE_TYPE_DIALOGOVEN = 67 DEVICE_TYPE_WINE_CABINET_FREEZER_COMBINATION = 68 )
const ( DEVICE_STATUS_OFF = 1 DEVICE_STATUS_ON = 2 DEVICE_STATUS_PROGRAMMED = 3 DEVICE_STATUS_PROGRAMMED_WAITING_TO_START = 4 DEVICE_STATUS_RUNNING = 5 DEVICE_STATUS_PAUSE = 6 DEVICE_STATUS_END_PROGRAMMED = 7 DEVICE_STATUS_FAILURE = 8 DEVICE_STATUS_PROGRAMME_INTERRUPTED = 9 DEVICE_STATUS_IDLE = 10 DEVICE_STATUS_RINSE_HOLD = 11 DEVICE_STATUS_SERVICE = 12 DEVICE_STATUS_SUPERFREEZING = 13 DEVICE_STATUS_SUPERCOOLING = 14 DEVICE_STATUS_SUPERHEATING = 15 DEVICE_STATUS_SUPERCOOLING_SUPERFREEZING = 146 DEVICE_STATUS_NOT_CONNECTED = 255 )
const ( ACTION_START = 1 ACTION_STOP = 2 ACTION_PAUSE = 3 ACTION_START_SUPERFREEZING = 4 ACTION_STOP_SUPERFREEZING = 5 ACTION_START_SUPERCOOLING = 6 ACTION_STOP_SUPERCOOLING = 7 )
const ( LIGHT_ENABLE = 1 LIGHT_DISABLE = 2 )
const ( VENTILATION_STEP1 = 1 VENTILATION_STEP2 = 2 VENTILATION_STEP3 = 3 VENTILATION_STEP4 = 4 )
Variables ¶
var Endpoint = oauth2.Endpoint{ AuthURL: "https://api.mcs3.miele.com/thirdparty/login", TokenURL: "https://api.mcs3.miele.com/thirdparty/token", AuthStyle: oauth2.AuthStyleInParams, }
Functions ¶
This section is empty.
Types ¶
type AuthTransport ¶
type AuthTransport struct {
VG string
}
AuthTransport can be used to add the required custom fields for an OAuth2 client using golang.org/x/oauth2. VG is the locale used when registering the Miele@Home account.
Example: hc := &http.Client{Transport: &miele.AuthTransport{VG: *vg}} ctx := context.WithValue(context.Background(), oauth2.HTTPClient, hc)
type Client ¶
type Client struct { BaseURL *url.URL UserAgent string Verbose bool // contains filtered or unexported fields }
func NewClient ¶
NewClient returns a new Miele 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 Miele API client using the supplied credentials.
func (*Client) DeviceAction ¶
func (c *Client) DeviceAction(deviceID string, request DeviceActionRequest) error
func (*Client) GetDevice ¶
func (c *Client) GetDevice(deviceID string, request GetDeviceRequest) (Device, error)
func (*Client) GetDeviceActions ¶
func (c *Client) GetDeviceActions(deviceID string, request GetDeviceActionsRequest) (GetDeviceActionsResponse, error)
func (*Client) GetDeviceIdent ¶
func (c *Client) GetDeviceIdent(deviceID string, request GetDeviceStateRequest) (Ident, error)
func (*Client) GetDeviceState ¶
func (c *Client) GetDeviceState(deviceID string, request GetDeviceStateRequest) (State, error)
func (*Client) ListDevices ¶
func (c *Client) ListDevices(request ListDevicesRequest) (ListDevicesResponse, error)
func (*Client) ListShortDevices ¶
func (c *Client) ListShortDevices(request ListShortDevicesRequest) (ListShortDevicesResponse, 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 DeviceAction ¶
type DeviceAction struct { ProcessAction []int `json:"processAction"` Light []int `json:"light"` StartTime [][]int `json:"startTime"` VentilationStep []int `json:"ventilationStep"` // Select a program, availability depends on device and device status. ProgramId []int `json:"programId"` TargetTemperature []struct { Zone int `json:"zone"` Min int `json:"min"` Max int `json:"max"` } `json:"targetTemperature"` DeviceName bool `json:"deviceName"` // powerOff device from on state to off state // availability depends on device and device status PowerOff bool `json:"powerOff"` // powerOn device from off state to on state // availability depends on device and device status PowerOn bool `json:"powerOn"` // change the ambient light color of a cooker hood. Colors string `json:"colors"` // Switch device in special operation modes. Modes int `json:"modes"` }
type DeviceActionRequest ¶
type DeviceIdentLabel ¶
type GetDeviceActionsRequest ¶
type GetDeviceActionsRequest struct {
LocalizedRequest
}
type GetDeviceActionsResponse ¶
type GetDeviceActionsResponse []DeviceAction
type GetDeviceIdentRequest ¶
type GetDeviceIdentRequest struct {
LocalizedRequest
}
type GetDeviceRequest ¶
type GetDeviceRequest struct {
LocalizedRequest
}
type GetDeviceStateRequest ¶
type GetDeviceStateRequest struct {
LocalizedRequest
}
type Ident ¶
type Ident struct { Typ LocalizedValue `json:"type"` DeviceName string `json:"deviceName"` DeviceIdentLabel DeviceIdentLabel `json:"deviceIdentLabel"` XkmIdentLabel XkmIdentLabel `json:"xkmIdentLabel"` }
type ListDevicesRequest ¶
type ListDevicesRequest struct {
LocalizedRequest
}
type ListDevicesResponse ¶
type ListShortDevicesRequest ¶
type ListShortDevicesRequest struct {
LocalizedRequest
}
type ListShortDevicesResponse ¶
type ListShortDevicesResponse []ShortDevice
type LocalizedRequest ¶
type LocalizedRequest struct { // The supported languages for localized values. If the language parameter // is missing or invalid, you will receive the english localization. // Available values : de, en Language string `url:"language,omitempty"` }
type LocalizedValue ¶
type ShortDevice ¶
type State ¶
type State struct { Status LocalizedValue `json:"status"` ProgramType LocalizedValue `json:"programType"` ProgramPhase LocalizedValue `json:"programPhase"` SignalInfo bool `json:"signalInfo"` SignalFailure bool `json:"signalFailure"` SignalDoor bool `json:"signalDoor"` RemoteEnable struct { FullRemoteControl bool `json:"fullRemoteControl"` SmartGrid bool `json:"smartGrid"` } `json:"remoteEnable"` Light int `json:"light"` ElapsedTime []int `json:"elapsedTime"` SpinningSpeed struct { Unit string `json:"unit"` ValueRaw int `json:"value_raw"` ValueLocalized string `json:"value_localized"` KeyLocalized string `json:"key_localized"` } `json:"spinningSpeed"` DryingStep LocalizedValue `json:"dryingStep"` VentilationStep LocalizedValue `json:"ventilationStep"` PlateStep []LocalizedValue `json:"plateStep"` EcoFeedback struct { CurrentWaterConsumption struct { Unit string `json:"unit"` Value float64 `json:"value"` } `json:"currentWaterConsumption"` CurrentEnergyConsumption struct { Unit string `json:"unit"` Value float64 `json:"value"` } `json:"currentEnergyConsumption"` WaterForecast float64 `json:"waterForecast"` EnergyForecast float64 `json:"energyForecast"` } `json:"ecoFeedback"` BatteryLevel int `json:"batteryLevel"` }