api

package
v0.0.0-...-1c24bed Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Type string `json:"type"`
	Name string `json:"devName"`
}

type Client

type Client struct {
	HTTPClient *http.Client
	BaseURL    string
	Logger     *log.Logger
	Key        string
	// contains filtered or unexported fields
}

Client is used to connect to the Meross Client

func NewClient

func NewClient(email, password string) Client

NewClient returns an API with sensible defaults

func (*Client) GetSupportedDevices

func (c *Client) GetSupportedDevices() ([]Device, error)

GetSupportedDevices connects to the Meross API and returns a slice of Device objects. This method can only be called after a successful call to Login.

func (*Client) Login

func (c *Client) Login() error

Login sends a login request to the Meross API and retrieves a token used for further authentication.

type Device

type Device struct {
	Name     string    `json:"devName"`
	Channels []Channel `json:"channels"`
	UUID     string    `json:"uuid"`
	Type     string    `json:"deviceType"`
	Domain   string    `json:"domain"`
	Region   string    `json:"region"`
	// contains filtered or unexported fields
}

Device contains the information specific to a particular Meross device.

func (*Device) Connect

func (d *Device) Connect(key string) error

Connect establishes a connection using MQTT http://mqtt.org over TCP sockets to allow the user to send signals to the device.

func (*Device) Disconnect

func (d *Device) Disconnect()

Disconnect closes the connection to the upstream server

func (*Device) TurnOff

func (d *Device) TurnOff(key string) error

TurnOff senss a signal to turn off a device

func (*Device) TurnOn

func (d *Device) TurnOn(key string) error

TurnOn sends a signal to turn on a device

Jump to

Keyboard shortcuts

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