Documentation ¶
Index ¶
- func CallMethod(property string, params ...Param) http.Handler
- func Config(config string) http.Handler
- func Get(h http.Handler) http.Handler
- func GetInfo(requestedProps ...interface{}) http.Handler
- func Handle(static fs.FS, config string)
- func HttpMethod(method string, h http.Handler) http.Handler
- func Post(h http.Handler) http.Handler
- func PowerOn(power bool) http.Handler
- func SetBrightness() http.Handler
- func SetColor() http.Handler
- func SetTemperature() http.Handler
- func Toggle() http.Handler
- func WithLogging(h http.Handler) http.Handler
- type ConstParam
- type MapParam
- type NumParam
- type Param
- type QueryParam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallMethod ¶
CallMethod handles the requests that sets a given smart light property according to the given parameters. It's the caller's job to make sure they conform to the Yeelight API.
The bulb address is specified in the "bulb" query parameter.
func GetInfo ¶
GetInfo serves the info about the requested properties of a bulb.
The bulb address is specified in the "bulb" query parameter.
func HttpMethod ¶
HttpMethod checks for the HTTP method of each handled request, rejecting all the other HTTP methods.
func SetTemperature ¶
SetTemperature sets the color temperature of a bulb.
Types ¶
type ConstParam ¶
type ConstParam struct {
Value interface{}
}
ConstParam has a constant value completely ignoring the HTTP request's contents.
type MapParam ¶
type MapParam struct { Param // contains filtered or unexported fields }
MapParam is a composite Param that maps the original Param's value through an arbitrary unary function.
type NumParam ¶
NumParam is a composite Param that converts the value of the original Param to a number.
func NewNumParamWithBase ¶
NewNumParamWithBase creates a NumParam with a custom base.
type Param ¶
Param is a parameter for the CallMethod calls, usually extracting some data from the associated HTTP request provided to the Get method.
type QueryParam ¶
type QueryParam struct {
// contains filtered or unexported fields
}
QueryParam extracts a value from the "param" query parameter.