yeel

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosing = errors.New("connection closing")
View Source
var ErrTimeout = errors.New("command timeout")

Functions

This section is empty.

Types

type Animation

type Animation []Keyframe

func (Animation) Expression

func (a Animation) Expression() (string, error)

type Brightness

type Brightness int

func NewBrightnessNorm

func NewBrightnessNorm(v float64) Brightness

func (Brightness) Int

func (b Brightness) Int() int

func (Brightness) Validate

func (b Brightness) Validate() error

type ColorTemprature

type ColorTemprature int

func (ColorTemprature) Int

func (c ColorTemprature) Int() int

func (ColorTemprature) Validate

func (c ColorTemprature) Validate() error

type ColorTempratureKeyframe

type ColorTempratureKeyframe struct {
	Duration        time.Duration
	Brightness      int
	ColorTemprature int
}

func (ColorTempratureKeyframe) Expression

func (r ColorTempratureKeyframe) Expression() (string, error)

type Command

type Command struct {
	ID     int           `json:"id"`
	Method string        `json:"method"`
	Params []interface{} `json:"params"`
	// contains filtered or unexported fields
}

Command .

type Commander

type Commander interface {
	Command() (Command, error)
}

type Conn

type Conn struct {
	Device Device

	NotificationC chan Notification
	// contains filtered or unexported fields
}

Conn .

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ExecCommand

func (c *Conn) ExecCommand(commander Commander) (Result, error)

func (*Conn) Open

func (c *Conn) Open() error

SendCommand sends a single named command to the Yeelight hub via TCP

type Device

type Device struct {
	CacheControl    string
	Location        string
	ID              string
	Model           string // mono, color, stripe
	FirmwareVersion string
	Support         map[string]bool
	Power           string
	Flowing         int
	FlowParams      string

	Brightness      int
	ColorMode       int
	ColorTemprature int
	RGB             int
	Hue             int
	Saturation      int

	Name string
}

func ParseDeviceFromHeader

func ParseDeviceFromHeader(header http.Header) (Device, error)

func (*Device) LocationAddr

func (d *Device) LocationAddr() string

type GetPropCommand

type GetPropCommand struct {
	Properties []string
}

GetPropCommand .

func (GetPropCommand) Command

func (g GetPropCommand) Command() (Command, error)

type Hue

type Hue int

func NewHueNorm

func NewHueNorm(v float64) Hue

func (Hue) Int

func (h Hue) Int() int

func (Hue) Validate

func (h Hue) Validate() error

type IllegalArgumentError

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

func (IllegalArgumentError) Error

func (e IllegalArgumentError) Error() string

type Keyframe

type Keyframe interface {
	Expression() (string, error)
}

type Notification

type Notification struct {
	DeviceID string
	Method   string
	Params   NotificationParams
}

Notification .

type NotificationParams

type NotificationParams struct {
	Bright     *int    `json:"bright"`
	CT         *int    `json:"ct"`
	RGB        *int    `json:"rgb"`
	Power      *string `json:"power"`
	Hue        *int    `json:"hue"`
	Sat        *int    `json:"sat"`
	ColorMode  *int    `json:"color_mode"`
	Flowing    *int    `json:"flowing"`
	DelayOff   *int    `json:"delayoff"`
	FlowParams *string `json:"flow_params"`
	MusicOn    *int    `json:"music_on"`
	Name       *string `json:"name"`
}

NotificationParams .

type RGB

type RGB struct {
	R, G, B int
}

RGB .

func IntToRGB

func IntToRGB(value int) RGB

func NewRGBNorm

func NewRGBNorm(r, g, b float64) RGB

func (RGB) HexRGB

func (R RGB) HexRGB() string

func (RGB) Int

func (R RGB) Int() int

func (RGB) String

func (R RGB) String() string

func (RGB) Validate

func (rgb RGB) Validate() error

type RGBKeyframe

type RGBKeyframe struct {
	Duration   time.Duration
	Brightness int
	RGB        RGB
}

func (RGBKeyframe) Expression

func (r RGBKeyframe) Expression() (string, error)

type RawKeyframe

type RawKeyframe struct {
	RawExpression string
}

RawKeyframe .

func (RawKeyframe) Expression

func (r RawKeyframe) Expression() (string, error)

type Result

type Result struct {
	ID     int
	Result []string
	Err    error
	Error  map[string]interface{}
}

Result .

type Saturation

type Saturation int

func NewSaturationNorm

func NewSaturationNorm(v float64) Saturation

func (Saturation) Int

func (s Saturation) Int() int

func (Saturation) Validate

func (s Saturation) Validate() error

type SetBrightnessCommand

type SetBrightnessCommand struct {
	Brightness int           `json:"brightness"`
	Duration   time.Duration `json:"duration"`
}

SetBrightnessCommand .

func (SetBrightnessCommand) Command

func (s SetBrightnessCommand) Command() (Command, error)

type SetBrightnessNormCommand

type SetBrightnessNormCommand struct {
	Brightness float64
	Duration   time.Duration
}

SetBrightnessNormCommand .

func (SetBrightnessNormCommand) Command

func (s SetBrightnessNormCommand) Command() (Command, error)

type SetColorTempratureCommand

type SetColorTempratureCommand struct {
	ColorTemprature int
	Duration        time.Duration
}

SetColorTempratureCommand .

func (SetColorTempratureCommand) Command

func (c SetColorTempratureCommand) Command() (Command, error)

type SetColorTempratureNormCommand

type SetColorTempratureNormCommand struct {
	ColorTemprature float64
	Duration        time.Duration
}

SetColorTempratureNormCommand .

type SetDefaultCommand

type SetDefaultCommand struct {
}

SetDefaultCommand .

func (SetDefaultCommand) Command

func (c SetDefaultCommand) Command() (Command, error)

type SetHSVCommand

type SetHSVCommand struct {
	Hue        int
	Saturation int
	Duration   time.Duration
}

SetHSVCommand .

func (SetHSVCommand) Command

func (s SetHSVCommand) Command() (Command, error)

type SetHSVNormCommand

type SetHSVNormCommand struct {
	Hue        float64
	Saturation float64
	Duration   time.Duration
}

SetHSVCommand .

func (SetHSVNormCommand) Command

func (s SetHSVNormCommand) Command() (Command, error)

type SetNameCommand

type SetNameCommand struct {
	Name string
}

SetNameCommand .

func (SetNameCommand) Command

func (c SetNameCommand) Command() (Command, error)

type SetPowerCommand

type SetPowerCommand struct {
	On       bool
	Duration time.Duration
}

SetPowerCommand .

func (SetPowerCommand) Command

func (s SetPowerCommand) Command() (Command, error)

type SetRGBCommand

type SetRGBCommand struct {
	R, G, B  int
	Duration time.Duration
}

func (SetRGBCommand) Command

func (s SetRGBCommand) Command() (Command, error)

type SetRGBNormCommand

type SetRGBNormCommand struct {
	R, G, B  float64
	Duration time.Duration
}

func (SetRGBNormCommand) Command

func (s SetRGBNormCommand) Command() (Command, error)

type SleepKeyframe

type SleepKeyframe struct {
	Duration time.Duration
}

func (SleepKeyframe) Expression

func (r SleepKeyframe) Expression() (string, error)

type StartColorFlowCommand

type StartColorFlowCommand struct {
	Count     int
	Action    int
	Animation Animation
}

StartColorFlowCommand .

func (StartColorFlowCommand) Command

func (s StartColorFlowCommand) Command() (Command, error)

type StopColorFlowCommand

type StopColorFlowCommand struct{}

StopColorFlowCommand .

func (StopColorFlowCommand) Command

func (c StopColorFlowCommand) Command() (Command, error)

type ToggleCommand

type ToggleCommand struct {
}

ToggleCommand .

func (ToggleCommand) Command

func (c ToggleCommand) Command() (Command, error)

type WhiteKeyframe

type WhiteKeyframe struct {
	Duration   time.Duration
	Brightness int
}

func (WhiteKeyframe) Expression

func (r WhiteKeyframe) Expression() (string, error)

Jump to

Keyboard shortcuts

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