util

package
v0.0.0-...-94e5b1b Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadConfig

func ReadConfig(path string, config interface{}) (err error)

ReadConfig reads configuration from a configuration file.

func SetupMqtt

func SetupMqtt(config MqttConfiguration, defaultMsgHandler MQTT.MessageHandler, onConnectHandler MQTT.OnConnectHandler) (client MQTT.Client)

SetupMqtt intializes the MQTT connection.

Types

type MqttConfiguration

type MqttConfiguration struct {
	Broker   string
	Username string
	Password string
	BasePath string
}

MqttConfiguration is a standard configuration that should be used in all IoT modules.

type Readings

type Readings struct {
	Solar    int32
	Obtained int32
	Total    int32
}

Readings contains the values to be read from the power meters

func NewReadings

func NewReadings(buf []byte) (r *Readings, err error)

NewReadings initializes a Readings data structure from a byte buffer.

func (Readings) ToBuf

func (r Readings) ToBuf() (buf []byte)

ToBuf converts a Readings instance to a bytes buffer.

Jump to

Keyboard shortcuts

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