Documentation ¶
Index ¶
Constants ¶
View Source
const ( DiscoveryPrefix = "homeassistant" DefaultServer = "localhost:1883" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the connection to the MQTT broker.
func NewMQTTClient ¶
NewMQTTClient will establish a new connection to the MQTT service, using the configuration found under the path specified with prefsPath.
func (*Client) Publish ¶
Publish will send the list of messages it is passed to the broker that the client is connected to. Any errors in publihsing will be returned.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(subs ...*Subscription) error
Subscribe will parse the list of subscriptions and listen on their topics, passing any received messages to their callback functions. Any error in setting up a subscription will be returned.
type Msg ¶
type Msg struct { Topic string Message json.RawMessage QOS byte Retained bool }
Msg represents a message that can be sent or received on the MQTT bus.
Click to show internal directories.
Click to hide internal directories.