api

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 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)

DiscoverBridgeAddress use meethue.com/api/nupnp to find the Philips Hue Bridge locally

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)

RegisterUser ask for Philips Hue Bridge to register a new username

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)

UnregisterUser delete the username on config from the Philips Hue Bridge

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

RegisterError represent the data from a failed RegisterResponse

type RegisterResponse added in v0.7.0

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

RegisterResponse represent the response from registering a username

type RegisterSuccess added in v0.7.0

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

RegisterSuccess represent the data from a succeeded RegisterResponse

type User added in v0.7.0

type User struct {
	DeviceType string `json:"devicetype"`
}

User is used to register a new username

Jump to

Keyboard shortcuts

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