mqtt

package
v0.0.0-...-5635ba1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HA_DEFAULT_TOPIC = "homeassistant"

Variables

View Source
var (
	ErrNotConnected = errors.New("not connected")
	ErrTopicIsEmpty = errors.New("topic is empty")
	ErrHANotInit    = errors.New("Home Assissstant not init")
)

Functions

func TopicPrepare

func TopicPrepare(topic string) []string

Types

type MQTT

type MQTT struct {
	// contains filtered or unexported fields
}

func New

func New(addr, user, password, clientId string) *MQTT

func (*MQTT) Close

func (c *MQTT) Close()

func (*MQTT) Connect

func (c *MQTT) Connect() error

func (*MQTT) HAInit

func (c *MQTT) HAInit(name, model, version string)

func (*MQTT) HAPublishDevice

func (c *MQTT) HAPublishDevice() error

func (*MQTT) IsConnected

func (c *MQTT) IsConnected() bool

func (*MQTT) Publish

func (c *MQTT) Publish(topic string, retained bool, message interface{}) error

func (*MQTT) PublishToDefault

func (c *MQTT) PublishToDefault(message interface{}) error

func (*MQTT) SetDefaultTopic

func (c *MQTT) SetDefaultTopic(topic, name string)

func (*MQTT) SetOnConnect

func (c *MQTT) SetOnConnect(f func())

Jump to

Keyboard shortcuts

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