hue

package module
v0.0.0-...-bea21ec Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 12 Imported by: 0

README

go-hue

Build Status Coverage Status Go Report Card Go Reference MIT License

TODO

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultClient provides an HTTP client implementation that uses the
	// InsecureSkipVerify flag to bypass errors caused by the bridge's
	// certificate - it does not contain a SAN for its IP address.
	DefaultClient = &http.Client{
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{
				InsecureSkipVerify: true,
			},
		},
	}
)

Functions

This section is empty.

Types

type Client

type Client struct {

	// Host represents the host address of the bridge.
	Host string

	// Username represents the application key used for authentication.
	Username string

	// Client represents the http.Client used for the connections. If this
	// value is nil, DefaultClient is used. Note that the client must be
	// willing to accept the bridge's certificate, which is not signed by a CA
	// recognized in most operating systems.
	Client *http.Client
}

Client represents a connection to a Hue bridge. Hostname must be set to the address of the bridge and Username needs to be set to the application key to use authenticated methods. Use the Register() method to obtain an application key.

func (*Client) Register

func (c *Client) Register(appName string) error

Register attempts to register with the bridge and obtain an application key. This will likely fail the first time with an error instructing the user to push the physical button on their bridge - an identical call to this method a second time should then succeed. Upon success, the application key will be stored in the Username field of the Client.

func (*Client) Resources

func (c *Client) Resources() ([]*bridge.Resource, error)

Resources retrieves all of the resources on the bridge.

func (*Client) Update

func (c *Client) Update(rType, id string, v *bridge.Resource) error

Update attempts to update the specified resource using the provided values.

type Watcher

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

Watcher receives events from the bridge and maintains a list of resources and their current states.

func NewWatcher

func NewWatcher(c *Client) (*Watcher, error)

NewWatcher creates and initializes a new watcher using the provided client.

func (*Watcher) Close

func (w *Watcher) Close()

Close shuts down the watcher.

func (*Watcher) Resources

func (w *Watcher) Resources() []*bridge.Resource

Resources returns a slice of resources and their current values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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