client

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2021 License: Apache-2.0 Imports: 9 Imported by: 4 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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() (*model.DeviceInfo, error)

DeviceInfo queries the ESPHome device information.

func (*Client) Hello

func (c *Client) Hello() (*model.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 model.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