api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiscoverBridgeAddress added in v0.7.0

func DiscoverBridgeAddress() (address string, err error)

func PutLamp

func PutLamp(config Config, lamp *Lamp) (err error)

PutLamp update the State of a Hue Lamp using the API

func RegisterUser added in v0.7.0

func RegisterUser(config Config) (username string, err error)

func SetConfig added in v0.6.0

func SetConfig(config *Config) (err error)

SetConfig write te config.yml file from the config parameter

func UnregisterUser added in v0.7.0

func UnregisterUser(config Config) (err error)

Types

type Config

type Config struct {
	Id       int    `yaml:"id"`
	Address  string `yaml:"address"`
	Username string `yaml:"username"`
	Steps    int    `yaml:"steps"`
}

Config contain the necessary data to interact with the API

func GetConfig

func GetConfig() (config Config, err error)

GetConfig read the config.yml file in the executable directory and return it

type Lamp

type Lamp struct {
	State LampState `json:"state"`
}

Lamp hold informations of a Hue Lamp from the API

func GetLamp

func GetLamp(config Config) (lamp *Lamp, err error)

GetLamp request to the API for informations about a Hue Lamp It returns a Lamp with the current State

type LampState

type LampState struct {
	On         bool `json:"on"`
	Brightness int  `json:"bri"`
	Reachable  bool `json:"reachable"`
}

LampState represents the State of a Hue Lamp from the API

type NUPnP added in v0.7.0

type NUPnP struct {
	Address string `json:"internalipaddress"`
}

NUPnP represents the response from the search of a Hue Bridge

type RegisterError added in v0.7.0

type RegisterError struct {
	ErrorType   int    `json:"type"`
	Address     string `json:"address"`
	Description string `json:"description"`
}

type RegisterResponse added in v0.7.0

type RegisterResponse struct {
	ErrorData   RegisterError   `json:"error"`
	SuccessData RegisterSuccess `json:"success"`
}

type RegisterSuccess added in v0.7.0

type RegisterSuccess struct {
	Username string `json:"username"`
}

type User added in v0.7.0

type User struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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