mqtt

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Name                string `yaml:"name"`                  // e.g. `open` or `close`
	Payload             string `yaml:"payload"`               // this could be the same or different than Name depending on the mqtt implementation
	TopicSuffix         string `yaml:"topic_suffix"`          // location where the command will be published; prefixed by MqttSettings.Topics.Prefix
	RequiredStartState  string `yaml:"required_start_state"`  // if set, garage door will not operate if current state does not equal this
	RequiredFinishState string `yaml:"required_finish_state"` // if set, garage door will monitor the door state compared to this value to determine success
	Timeout             int    `yaml:"timeout"`               // time to wait for garage door to operate if monitored
}

type MqttGdo

type MqttGdo interface {
	// InitializeMqttClient initializes the client by setting the connection options, connecting
	// to the mqtt broker, and subscribing to topics
	InitializeMqttClient()

	// SetGarageDoor operates the garage door by publishing to the configured mqtt topic with the configured payload
	SetGarageDoor(string) error
	// process any required shutdown events, such as service disconnects
	ProcessShutdown()
	// contains filtered or unexported methods
}

MqttGdo is the interface definition for an MqttGdo used by this library The interface is primarily used for mocking tests

func Initialize

func Initialize(config map[string]interface{}) (MqttGdo, error)

wrapper function to parse the config, initialize the connection to the mqtt broker, and return the MqttGdo object

func NewMqttGdo

func NewMqttGdo(config map[string]interface{}) (MqttGdo, error)

parses the config and returns an MqttGdo object

Jump to

Keyboard shortcuts

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