Documentation
¶
Index ¶
- func DeviceTypeStrings() []string
- type Client
- func (x *Client) GetCurrentPower() (float64, error)
- func (x *Client) IsModeColor() (bool, error)
- func (x *Client) IsModeWhite() (bool, error)
- func (x *Client) IsPowerOn() (bool, error)
- func (x *Client) SetModeColor(opts ModeColorOptions) error
- func (x *Client) SetModeWhite(opts ModeWhiteOptions) error
- func (x *Client) SetPower(on bool) error
- func (x *Client) SetPowerOff() error
- func (x *Client) SetPowerOn() error
- type Device
- type DeviceType
- type ModeColorOptions
- func (x *ModeColorOptions) MustValidate() *ModeColorOptions
- func (x *ModeColorOptions) SetBrightness(brightness int) *ModeColorOptions
- func (x *ModeColorOptions) SetColor(color colorful.Color) *ModeColorOptions
- func (x *ModeColorOptions) SetGain(gain int) *ModeColorOptions
- func (x *ModeColorOptions) SetTransitionTime(milliseconds int) *ModeColorOptions
- type ModeWhiteOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeviceTypeStrings ¶
func DeviceTypeStrings() []string
DeviceTypeStrings returns a slice of all String values of the enum
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client for communication with a Shelly-powered device.
func NewClient ¶
NewClient returns a new Client that is configured to be talking to the given Device.
func (*Client) GetCurrentPower ¶
GetCurrentPower returns the current power consumption of the attached devices in Watts.
func (*Client) IsModeColor ¶
func (*Client) IsModeWhite ¶
func (*Client) SetModeColor ¶
func (x *Client) SetModeColor(opts ModeColorOptions) error
func (*Client) SetModeWhite ¶
func (x *Client) SetModeWhite(opts ModeWhiteOptions) error
func (*Client) SetPower ¶
SetPower sets the power state for the configured device. See documentation at https://shelly-api-docs.shelly.cloud/gen1/#shelly-plug-plugs-relay-0
func (*Client) SetPowerOff ¶
SetPowerOff turns the power off for the configured device.
func (*Client) SetPowerOn ¶
SetPowerOn turns the power on for the configured device.
type Device ¶
type Device struct { Hostname string Type DeviceType }
Device is a Shelly-powered device
func (Device) GetAPIBaseURL ¶
GetAPIBaseURL returns the base URL to be used to send commands to this Shelly device.
type DeviceType ¶
type DeviceType int
const ( PlugS DeviceType = iota BulbRGBW )
func DeviceTypeString ¶
func DeviceTypeString(s string) (DeviceType, error)
DeviceTypeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func DeviceTypeValues ¶
func DeviceTypeValues() []DeviceType
DeviceTypeValues returns all values of the enum
func (DeviceType) IsADeviceType ¶
func (i DeviceType) IsADeviceType() bool
IsADeviceType returns "true" if the value is listed in the enum definition. "false" otherwise
func (DeviceType) String ¶
func (i DeviceType) String() string
type ModeColorOptions ¶
type ModeColorOptions struct { Brightness *int Transition *int Gain *int Color *colorful.Color Error error }
func NewModeColorOptions ¶
func NewModeColorOptions() *ModeColorOptions
func (*ModeColorOptions) MustValidate ¶
func (x *ModeColorOptions) MustValidate() *ModeColorOptions
func (*ModeColorOptions) SetBrightness ¶
func (x *ModeColorOptions) SetBrightness(brightness int) *ModeColorOptions
func (*ModeColorOptions) SetColor ¶
func (x *ModeColorOptions) SetColor(color colorful.Color) *ModeColorOptions
func (*ModeColorOptions) SetGain ¶
func (x *ModeColorOptions) SetGain(gain int) *ModeColorOptions
func (*ModeColorOptions) SetTransitionTime ¶
func (x *ModeColorOptions) SetTransitionTime(milliseconds int) *ModeColorOptions
type ModeWhiteOptions ¶
func NewModeWhiteOptions ¶
func NewModeWhiteOptions() *ModeWhiteOptions
func (*ModeWhiteOptions) MustValidate ¶
func (x *ModeWhiteOptions) MustValidate() *ModeWhiteOptions
func (*ModeWhiteOptions) SetBrightness ¶
func (x *ModeWhiteOptions) SetBrightness(brightness int) *ModeWhiteOptions
func (*ModeWhiteOptions) SetTemp ¶
func (x *ModeWhiteOptions) SetTemp(kelvin int) *ModeWhiteOptions
func (*ModeWhiteOptions) SetTransitionTime ¶
func (x *ModeWhiteOptions) SetTransitionTime(milliseconds int) *ModeWhiteOptions