mqtt

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPublisher

func NewPublisher(options PublisherOptions, logger *zap.Logger) (smartmeter.Publisher, error)

Types

type HomeAssistantOptions

type HomeAssistantOptions struct {
	DiscoveryEnabled  bool          `env:"MQTT_HOMEASSISTANT_DISCOVERY_ENABLED" flag:"discovery-enabled" desc:"whether HomeAssistant MQTT discovery is enabled"`
	DiscoveryPrefix   string        `env:"MQTT_HOMEASSISTANT_DISCOVERY_PREFIX" flag:"discovery-prefix" desc:"HomeAssistant MQTT discovery prefix"`
	DiscoveryQoS      int           `env:"MQTT_HOMEASSISTANT_DISCOVERY_QOS" flag:"discovery-qos" desc:"HomeAssistant MQTT discovery QoS"`
	DiscoveryInterval time.Duration `env:"MQTT_HOMEASSISTANT_DISCOVERY_INTERVAL" flag:"discovery-interval" desc:"HomeAssistant MQTT discovery interval"`
	DevicePrefix      string        `env:"MQTT_HOMEASSISTANT_DEVICE_PREFIX" flag:"device-prefix" desc:"HomeAssistant device prefix"`

	UniqueIDPrefix     string   `env:"MQTT_HOMEASSISTANT_UNIQUE_ID_PREFIX" flag:"unique-id" desc:"HomeAssistant unique ID prefix"`
	DeviceIdentifiers  []string `env:"MQTT_HOMEASSISTANT_DEVICE_IDENTIFIERS" flag:"device-identifiers" desc:"HomeAssistant identifiers"`
	DeviceManufacturer string   `env:"MQTT_HOMEASSISTANT_DEVICE_MANUFACTURER" flag:"device-manufacturer" desc:"HomeAssistant manufacturer"`
	DeviceModel        string   `env:"MQTT_HOMEASSISTANT_DEVICE_MODEL" flag:"device-model" desc:"HomeAssistant model"`
	DeviceName         string   `env:"MQTT_HOMEASSISTANT_DEVICE_NAME" flag:"device-name" desc:"HomeAssistant name"`
}

type PublisherOptions

type PublisherOptions struct {
	Brokers  []string `env:"MQTT_BROKERS" flag:"brokers" desc:"MQTT broker addresses, leave empty to disable"`
	ClientID string   `env:"MQTT_CLIENT_ID" flag:"client-id" desc:"MQTT client ID, default will be autogenerated based on the client hostname"`
	Username string   `env:"MQTT_USERNAME" flag:"username" desc:"MQTT username"`
	Password string   `env:"MQTT_PASSWORD" flag:"password" desc:"MQTT password"`

	Topic string `env:"MQTT_TOPIC" flag:"topic" desc:"topic to publish to"`
	QoS   int    `env:"MQTT_QOS" flag:"qos" desc:"the QoS to send the messages at"`

	HomeAssistant HomeAssistantOptions `env:",squash"`

	Debug bool `env:"MQTT_DEBUG" flag:"debug" desc:"whether to enable debug logging"`
}

Jump to

Keyboard shortcuts

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