Documentation
¶
Overview ¶
Package mqttop implements a bridge to provide system metrics to the MQTT broker.
Configuration can be loaded from multiple YAML files, including from directories. If no config file is specified, the default path(s) will be determined by the first defined value of $MQTTOP_CONFIG_PATH, $XDG_CONFIG_HOME/mqttop.yaml, or $HOME/.config/mqttop.yaml. In the case of $MQTTOP_CONFIG_PATH, the value may be a comma-separated list of paths. If none of these files exist, the default configuration will be used, which looks for the following environment variables:
- broker: $MQTTOP_BROKER_ADDRESS
- username: $MQTTOP_BROKER_USERNAME
- password: $MQTTOP_BROKER_PASSWORD
Full documentation is available at: https://pkg.go.dev/github.com/lone-faerie/mqttop
Index ¶
- type Bridge
- func (b *Bridge) Connect(ctx context.Context) error
- func (b *Bridge) Disconnect()
- func (b *Bridge) Discover(ctx context.Context, path string) (err error)
- func (b *Bridge) Done() <-chan struct{}
- func (b *Bridge) IsConnected() bool
- func (b *Bridge) IsConnectionOpen() bool
- func (b *Bridge) Ready() <-chan error
- func (b *Bridge) Start(ctx context.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge is the mqtt client that bridges metrics to the mqtt broker.
func New ¶
New returns a new Bridge with the provided config and a [mqtt.Client] derived from the config. The bridge must have Bridge.Connect and Bridge.Ready called on it before it may be used. This follows the convention of [mqtt.NewClient] as well as waiting for metrics to be ready.
func NewWithClient ¶ added in v0.0.13
NewWithClient returns a new Bridge with the provided config and [mqtt.Client]. The bridge must have Bridge.Connect and Bridge.Ready called on it before it may be used. This follows the convention of [mqtt.NewClient] as well as waiting for metrics to be ready.
func (*Bridge) Connect ¶
Connect will create a connection to the message broker with the provided context, by default it will attempt to connect at v3.1.1 and auto retry at v3.1 if that fails
func (*Bridge) Disconnect ¶
func (b *Bridge) Disconnect()
Disconnect will end the connection with the server.
func (*Bridge) Discover ¶
Discover publishes the discovery payload(s) for Home Assistant MQTT discovery after optionally waiting for a payload on the given wait topic. If path is a non-empty string, the previous discovery is loaded from the file at path for removing old components.
func (*Bridge) Done ¶ added in v0.0.15
func (b *Bridge) Done() <-chan struct{}
Done returns a channel that can be used to wait until the bridge has disconnected.
func (*Bridge) IsConnected ¶ added in v0.0.15
IsConnected returns a bool signifying whether the bridge is connected or not.
func (*Bridge) IsConnectionOpen ¶ added in v0.0.15
IsConnectionOpen return a bool signifying whether the bridge has an active connection to mqtt broker, i.e not in disconnected or reconnect mode
Directories
¶
Path | Synopsis |
---|---|
Package config provides the structures used for configuration.
|
Package config provides the structures used for configuration. |
Package discovery provides structures to support Home Assistant MQTT Discovery.
|
Package discovery provides structures to support Home Assistant MQTT Discovery. |
icon
Package icon provides a few useful [Material Design Icons].
|
Package icon provides a few useful [Material Design Icons]. |
internal
|
|
build
Package build provides varaibles that are set at build-time with the -X ldflag.
|
Package build provides varaibles that are set at build-time with the -X ldflag. |
byteutil
Package byteutil implements functions for the manipulation of byte slices.
|
Package byteutil implements functions for the manipulation of byte slices. |
file
Package file provides an interface for working with files and directories under a root directory.
|
Package file provides an interface for working with files and directories under a root directory. |
syncutil
Package syncutil provides synchronization primitives.
|
Package syncutil provides synchronization primitives. |
Package log provides structured logging with severity levels.
|
Package log provides structured logging with severity levels. |
Package metrics provides the implementations of supported system metrics.
|
Package metrics provides the implementations of supported system metrics. |
Package procfs provides access to various files in /proc
|
Package procfs provides access to various files in /proc |
Package procfs provides access to various files in /sys and /etc
|
Package procfs provides access to various files in /sys and /etc |