oneplus

package
v0.0.0-...-5d2b6ea Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shelly1Plus

type Shelly1Plus struct {
	AuthKey    string
	BaseURL    string
	DeviceID   string
	HTTPClient *http.Client
}

Shelly1Plus struct represents the state.

func NewClient

func NewClient(authKey string, baseURL string, deviceID string) *Shelly1Plus

NewClient Create a new clients with the given params

func (*Shelly1Plus) GetDeviceStatus

func (s *Shelly1Plus) GetDeviceStatus() (shellymodels.Status, error)

GetDeviceStatus returns the status of the device

func (*Shelly1Plus) Off

func (s *Shelly1Plus) Off(channelID int) (bool, error)

Off switch the relay off

func (*Shelly1Plus) On

func (s *Shelly1Plus) On(channelID int) (bool, error)

On switch the relay on

func (*Shelly1Plus) Toggle

func (s *Shelly1Plus) Toggle(channelID int) (bool, error)

Toggle toggles the current state of the switch

type SwitchData

type SwitchData struct {
	DeviceID string `json:"device_id"`
}

type SwitchResponse

type SwitchResponse struct {
	Isok bool       `json:"isok"`
	Data SwitchData `json:"data"`
}

Jump to

Keyboard shortcuts

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