hue

package
v0.0.0-...-afee32f Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Config
	// contains filtered or unexported fields
}

func New

func New(c Config) *Client

func (*Client) Light

func (h *Client) Light(id string) (Light, error)

func (*Client) LightPut

func (h *Client) LightPut(id string, req LightPutRequest) error

func (*Client) Lights

func (h *Client) Lights() ([]Light, error)

func (*Client) Watch

func (h *Client) Watch(ctx context.Context) (<-chan Event, error)

type Color

type Color struct {
	XY XY `json:"xy"`
}

type Config

type Config struct {
	Host string
	Key  string
}

type Error

type Error struct {
	Description string `json:"description"`
}

func (Error) Error

func (e Error) Error() string

type Event

type Event struct {
	CreationTime string      `json:"creationtime"`
	Data         []EventData `json:"data"`
	Id           string      `json:"id"`
	Type         string      `json:"type"`
}

type EventData

type EventData struct {
	Color   *Color `json:"color"`
	Dimming *struct {
		Brightness float64 `json:"brightness"`
	} `json:"dimming"`
	Gradient *struct {
		Points        []Point `json:"points"`
		PointsCapable float64 `json:"points_capable"`
	} `json:"gradient"`
	Id   string `json:"id"`
	IdV1 string `json:"id_v1"`
	On   *struct {
		On bool `json:"on"`
	} `json:"on"`
	Owner struct {
		Rid   string `json:"rid"`
		Rtype string `json:"rtype"`
	} `json:"owner"`
	Type string `json:"type"`
}

type Light

type Light struct {
	Alert struct {
		ActionValues []string `json:"action_values"`
	} `json:"alert"`
	Color *struct {
		Gamut struct {
			Blue  XY `json:"blue"`
			Green XY `json:"green"`
			Red   XY `json:"red"`
		} `json:"gamut"`
		GamutType string `json:"gamut_type"`
		XY        XY     `json:"xy"`
	} `json:"color"`
	ColorTemperature *struct {
		Mirek       interface{} `json:"mirek"`
		MirekSchema struct {
			MirekMaximum float64 `json:"mirek_maximum"`
			MirekMinimum float64 `json:"mirek_minimum"`
		} `json:"mirek_schema"`
		MirekValid bool `json:"mirek_valid"`
	} `json:"color_temperature"`
	ColorTemperatureDelta struct {
	} `json:"color_temperature_delta"`
	Dimming *struct {
		Brightness  float64 `json:"brightness"`
		MinDimLevel float64 `json:"min_dim_level"`
	} `json:"dimming"`
	DimmingDelta struct {
	} `json:"dimming_delta"`
	Dynamics struct {
		Speed        float64  `json:"speed"`
		SpeedValid   bool     `json:"speed_valid"`
		Status       string   `json:"status"`
		StatusValues []string `json:"status_values"`
	} `json:"dynamics"`
	Effects struct {
		EffectValues []string `json:"effect_values"`
		Status       string   `json:"status"`
		StatusValues []string `json:"status_values"`
	} `json:"effects"`
	Gradient *struct {
		Mode          string   `json:"mode"`
		ModeValues    []string `json:"mode_values"`
		PixelCount    int      `json:"pixel_count"`
		Points        []Point  `json:"points"`
		PointsCapable int      `json:"points_capable"`
	} `json:"gradient"`
	Id       string `json:"id"`
	IdV1     string `json:"id_v1"`
	Metadata struct {
		Archetype string `json:"archetype"`
		Name      string `json:"name"`
	} `json:"metadata"`
	Mode string `json:"mode"`
	On   struct {
		On bool `json:"on"`
	} `json:"on"`
	Owner struct {
		Rid   string `json:"rid"`
		Rtype string `json:"rtype"`
	} `json:"owner"`
	Powerup struct {
		Color struct {
			Mode string `json:"mode"`
		} `json:"color"`
		Configured bool `json:"configured"`
		Dimming    struct {
			Mode string `json:"mode"`
		} `json:"dimming"`
		On struct {
			Mode string `json:"mode"`
			On   struct {
				On bool `json:"on"`
			} `json:"on"`
		} `json:"on"`
		Preset string `json:"preset"`
	} `json:"powerup"`
	Signaling struct {
		SignalValues []string `json:"signal_values"`
	} `json:"signaling"`
	TimedEffects struct {
		EffectValues []string `json:"effect_values"`
		Status       string   `json:"status"`
		StatusValues []string `json:"status_values"`
	} `json:"timed_effects"`
	Type string `json:"type"`
}

type LightPutColor

type LightPutColor struct {
	XY XY `json:"xy"`
}

func NewLightPutColor

func NewLightPutColor(x, y float64) *LightPutColor

type LightPutDimming

type LightPutDimming struct {
	Brightness float64 `json:"brightness"`
}

type LightPutDynamics

type LightPutDynamics struct {
	Duration int64 `json:"duration"`
}

type LightPutGradient

type LightPutGradient struct {
	Points []Point `json:"points"`
}

type LightPutOn

type LightPutOn struct {
	On bool `json:"on"`
}

type LightPutRequest

type LightPutRequest struct {
	On       *LightPutOn       `json:"on,omitempty"`
	Dimming  *LightPutDimming  `json:"dimming,omitempty"`
	Color    *LightPutColor    `json:"color,omitempty"`
	Gradient *LightPutGradient `json:"gradient,omitempty"`
	Dynamics *LightPutDynamics `json:"dynamics,omitempty"`
}

type LightResponse

type LightResponse struct {
	Lights []Light `json:"data"`
	Errors []Error `json:"errors"`
}

type Point

type Point struct {
	Color Color `json:"color"`
}

func NewPoint

func NewPoint(x, y float64) Point

type PutResponse

type PutResponse struct {
	Data []struct {
		Rid   string `json:"rid"`
		Rtype string `json:"rtype"`
	} `json:"data"`
	Errors []Error `json:"errors"`
}

type XY

type XY struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

Jump to

Keyboard shortcuts

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