modules

package
v0.0.0-...-bb884da Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Modules = map[string]ModuleBuilder{}

Functions

func Register

func Register(name string, builder ModuleBuilder)

Register stores a builder function into the registry for external access. Register() can be called from init() on a module in this package and will automatically register a module.

Types

type DeviceModule

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

Device Module encapsulates all the logic regarding the devices. The logic is the following: devices output values can be changed from mqtt and forwarded to digitalstrom on the opposite side, when an event is received from digitalstrom, the new value is pushed to mqtt.

func (*DeviceModule) GetHomeAssistantEntities

func (c *DeviceModule) GetHomeAssistantEntities() ([]homeassistant.DiscoveryConfig, error)

func (*DeviceModule) Start

func (c *DeviceModule) Start() error

func (*DeviceModule) Stop

func (c *DeviceModule) Stop() error

type MeteringsModule

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

Meterings Module encapsulates all the logic regarding the meterings of the controllers. The logic is the following: every 10 seconds the meterings values are being checked and pushed to the corresponding topic in the MQTT server.

func (*MeteringsModule) GetHomeAssistantEntities

func (c *MeteringsModule) GetHomeAssistantEntities() ([]homeassistant.DiscoveryConfig, error)

func (*MeteringsModule) Start

func (c *MeteringsModule) Start() error

func (*MeteringsModule) Stop

func (c *MeteringsModule) Stop() error

type Module

type Module interface {
	Start() error
	Stop() error
}

Interface for the different modules being

func NewDeviceModule

func NewDeviceModule(mqttClient mqtt.Client, dsClient digitalstrom.Client, dsRegistry digitalstrom.Registry, config *config.Config) Module

func NewMeteringsModule

func NewMeteringsModule(mqttClient mqtt.Client, dsClient digitalstrom.Client, dsRegistry digitalstrom.Registry, config *config.Config) Module

Jump to

Keyboard shortcuts

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