mqtt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package mqtt wraps the Eclipse Paho code for handling paho messaging

Index

Constants

View Source
const (
	GatewayStatusTopic = "status/gateway"
	SensorStatusTopic  = "status/sensor"
	TemperatureTopic   = "measurement/temperature"
	RainTopic          = "measurement/rain"
	SensorEventTopic   = "sensor/event"
)

mqtt topics for events, measurements, status

View Source
const (
	SensorPauseEvent     = "sensorPause"
	SensorUnpauseEvent   = "sensorUnpause"
	SensorSoftResetEvent = "sensorSoftReset"
	SensorHardResetEvent = "sensorHardReset"
)

mqtt event tags

Variables

View Source
var SampleCelsius = 23

SampleCelsius is a random temperature value picked for no reason

Functions

func NewConnection

func NewConnection() (paho.Client, error)

NewConnection creates a new MQTT connection or error

Types

type BrokerConfig

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

BrokerConfig configures the mqtt connection

type SampleMessage

type SampleMessage struct {
	Topic     string
	Msg       map[string]interface{}
	Timestamp time.Time
}

SampleMessage is a dummy message

func SampleGatewayStatus

func SampleGatewayStatus(timestamp time.Time) SampleMessage

SampleGatewayStatus is a test mqtt message for a gateway status message

func SampleRain

func SampleRain(timestamp time.Time) SampleMessage

SampleRain is a test mqtt message for a rain event

func SampleSensorHardReset

func SampleSensorHardReset(timestamp time.Time) SampleMessage

SampleSensorHardReset is a test mqtt message for a hard reset event

func SampleSensorPause

func SampleSensorPause(timestamp time.Time) SampleMessage

SampleSensorPause is a test mqtt message for a pause event

func SampleSensorSoftReset

func SampleSensorSoftReset(timestamp time.Time) SampleMessage

SampleSensorSoftReset is a test mqtt message for a soft reset event

func SampleSensorStatus

func SampleSensorStatus(timestamp time.Time) SampleMessage

SampleSensorStatus is a test mqtt message for a sensor status message

func SampleSensorUnpause

func SampleSensorUnpause(timestamp time.Time) SampleMessage

SampleSensorUnpause is a test mqtt message for an unpause event

func SampleTemp

func SampleTemp(timestamp time.Time) SampleMessage

SampleTemp is a test mqtt message for a temperature measurement in C

Jump to

Keyboard shortcuts

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