Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Authenticate ¶
Authenticate connects to the given address with the give PSK (which can be found underneath the IKEA TRADFRI Gateway. On a successfull connection we'll return a new identity and PSK which should be used for further access to the gateway.
Types ¶
type AuthenticateReq ¶
type AuthenticateReq struct {
Identity string `json:"9090"`
}
AuthenticateReq contains the data model that should be sent to the IKEA Trådfri gateway to retrieve a new identifier/PSK pair.
type AuthenticateResp ¶
AuthenticateResp contains the data model that is returned by the IKEA Trådfri gateway on a successfull authentication.
type Bulb ¶
type Bulb struct {
JSON []byte
Info Info `json:"3"`
LightControl []struct {
Color string `json:"5706"`
ColorHue int `json:"5707"`
ColorSat int `json:"5708"`
ColorX int `json:"5709"`
ColorY int `json:"5710"`
Power int `json:"5850"`
Dim int `json:"5851"`
Mireds int `json:"5711"`
Duration int `json:"5712"`
} `json:"3311"`
ApplicationType int `json:"5750"`
Name string `json:"9001"`
CreatedAt int `json:"9002"`
ID int `json:"9003"`
ReachableState int `json:"9019"`
LastSeen int `json:"9020"`
OTAUpdateState int `json:"9054"`
}
Bulb contains the data structure that the Gateway returns when a bulb device is requested.
type ControlOutlet ¶
type ControlOutlet struct {
JSON []byte
Info Info `json:"3"`
Plug struct {
Power int `json:"5850"`
Dim int `json:"5851"`
ID int `json:"9003"`
}
ApplicationType int `json:"5750"`
Name string `json:"9001"`
CreatedAt int `json:"9002"`
ID int `json:"9003"`
ReachableState int `json:"9019"`
LastSeen int `json:"9020"`
OTAUpdateState int `json:"9054"`
}
type Device ¶
type Device struct {
JSON []byte
Info Info `json:"3"`
Name string `json:"9001"`
CreatedAt int `json:"9002"`
ID int `json:"9003"`
ReachableState int `json:"9019"`
LastSeen int `json:"9020"`
}
Device contains the structure of an unknown IKEA Trådfri device.
func (*Device) IsControlOutlet ¶
IsControlOutlet checks whether or not the device is a control outlet or not.
type Gateway ¶
type Gateway struct {
// contains filtered or unexported fields
}
Gateway.
func Connect ¶
Connect initializes a new connection to the given address with the identifier and psk, if the connection is successful we'll return a new instance of the gateway, if not an error is returned.
func (*Gateway) GetBulb ¶
GetBulb gets the bulb with the given ID from the gateway, if the requested device isn't a bulb or if it doesn't exist an error is returned. Otherwise a filled Bulb object is returned.
func (*Gateway) GetControlOutlet ¶
func (gw *Gateway) GetControlOutlet(id int) (*ControlOutlet, error)
GetControlOutlet gets the control outlet with the given id.
func (*Gateway) ListDeviceIDs ¶
ListDevices retrieves a list of all the device ids that has been connected to the gateway.