client

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPassword             = errors.New("esphome_api: invalid password")
	ErrCommunicationTimeout = errors.New("esphome_api: communication timeout")
)

Error types

Functions

This section is empty.

Types

type Client

type Client struct {
	ID string

	CommunicationTimeout time.Duration
	// contains filtered or unexported fields
}

Client struct.

func Init

func Init(clientID, addr string, timeout time.Duration, handlerFunc func(proto.Message)) (*Client, error)

Init func

func (*Client) Close

func (c *Client) Close() error

Close the client

func (*Client) DeviceInfo

func (c *Client) DeviceInfo() (*types.DeviceInfo, error)

DeviceInfo queries the ESPHome device information.

func (*Client) Hello

func (c *Client) Hello() (*types.HelloResponse, error)

Hello func

func (*Client) LastMessageAt

func (c *Client) LastMessageAt() time.Time

LastMessage returns the time of the last message received.

func (*Client) ListEntities

func (c *Client) ListEntities() error

ListEntities func

func (*Client) Login

func (c *Client) Login(password string) error

Login func

func (*Client) Ping

func (c *Client) Ping() error

Ping func

func (*Client) Send

func (c *Client) Send(message proto.Message) error

func (*Client) SendAndWaitForResponse

func (c *Client) SendAndWaitForResponse(message proto.Message, messageType uint64) (proto.Message, error)

func (*Client) SubscribeLogs

func (c *Client) SubscribeLogs(level types.LogLevel) error

SubscribeLogs func

func (*Client) SubscribeStates

func (c *Client) SubscribeStates() error

SubscribeStates func

Jump to

Keyboard shortcuts

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