wiz

package module
v0.0.0-...-92ffeb2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: MIT Imports: 7 Imported by: 0

README

gowiz

Go library for WiZ lights.

This just supports a few very basic functions so far. It has only been tested with the LED-Lightstrip from WiZ.

go get github.com/ctrox/gowiz

There is a small sample program in the cmd/wizctl directory which will just make your LED strip pulse.

go run github.com/ctrox/gowiz/cmd/wizctl -addr 192.168.1.194

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Colors

type Colors struct {
	White int
	Red   int
	Blue  int
	Green int
}

type Light

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

func New

func New(address net.Addr, opts ...Option) (*Light, error)

func (*Light) Pulse

func (l *Light) Pulse(ctx context.Context, colors Colors)

func (*Light) SendMessage

func (l *Light) SendMessage(msg *Message) (*Reply, error)

func (*Light) SetColor

func (l *Light) SetColor(colors Colors, dim int) error

func (*Light) TurnOff

func (l *Light) TurnOff() error

func (*Light) TurnOn

func (l *Light) TurnOn() error

type Message

type Message struct {
	Method string `json:"method"`
	Params Params `json:"params"`
}

type Option

type Option func(l *Light)

func Logger

func Logger(logger *zap.Logger) Option

func Timeout

func Timeout(d time.Duration) Option

type Params

type Params struct {
	State   bool `json:"state"`
	White   int  `json:"w,omitempty"`
	Red     int  `json:"r,omitempty"`
	Blue    int  `json:"b,omitempty"`
	Green   int  `json:"g,omitempty"`
	Dimming int  `json:"dimming,omitempty"`
}

type Reply

type Reply struct {
	Method string `json:"method"`
	Env    string `json:"env"`
	Result Result `json:"result"`
}

func (*Reply) MarshalLogObject

func (reply *Reply) MarshalLogObject(enc zapcore.ObjectEncoder) error

type Result

type Result struct {
	Success bool `json:"success"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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